问题标签 [image-rendering]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
390 浏览

ios - 使用 UIGraphicsImageRenderer 渲染全尺寸图像

使用我们设备相机拍摄的图像比我们 iOS 设备上的屏幕大。通常,当我们在 iOS 中渲染图像时,我会看到人们将渲染大小设置为主视图或图像视图的大小。

这个堆栈溢出响应所示。

这样做会使图像更小,质量更低。

如果逻辑如下。

如果我让图像视图超出设备屏幕,是否有可能以全尺寸渲染图像。换句话说,图像视图将设置为原始全尺寸图像的大小。

这样做会生成与原始图像具有相同像素大小的渲染图像吗?


到目前为止我做了什么?我测试了其他图像叠加/编辑应用程序,它们似乎减少了图像的像素大小。我使用了上面链接中提供的方法,他们也这样做。

0 投票
1 回答
694 浏览

drupal - 使用覆盖 Drupal 8 渲染图像

我正在建立一个 Drupal 网站,我需要上传一张图片、一些文本,然后用文本作为叠加层渲染该图片,甚至可能还有一个徽标。在 Drupal 8 上是否有模块或方法可以做到这一点?

澄清:我需要生成一张新图片并将叠加层添加为像素数据。

0 投票
1 回答
300 浏览

java - 如何在 JTable 中使用 Jtable 列按钮渲染来渲染图像?

如何将图像添加到自定义 JTable 行按钮,我在第四列中有一个带有 JButton 的 JTable,我想使用该按钮“上传”将图像放入第五列。

**注意:按钮用作文件上传器。

这是我的图像

图片

这是代码:

新框架.java

ComboTableCellRenderer.java

0 投票
1 回答
546 浏览

ios - UIView 到 UIImage 使用 UIGraphicsImageRenderer 错误地用 alpha 渲染图像

我正在将 UIView 转换为 UIImage,以将其设置为导航栏背景。

那是视图有一个渐变层,当我使用setBackgroundImage(_ backgroundImage: UIImage?, for barMetrics: UIBarMetrics)转换后的视图时,导航变得有点透明,比如 0.8 alpha

这是我正在使用的代码:

asImage()这是一个将 UIView 转换为 UIImage 的 UIView 扩展:

结果:样本

0 投票
1 回答
97 浏览

graphics - Eliminate skewing effect in combined track and zoom

I am writing for HTML5 Canvas, using it as a viewport on which I maintain a central origin and zoom level. I want to track and zoom to a region, but have encountered a naturally occurring effect that spoils the look I am trying to obtain. This question concerns how I might mitigate this while preserving a natural-looking effect.

Imagine I have a downwards-pointing camera mounted on the ceiling, and somewhere on the floor is a piece of paper. I move the camera at a constant speed along the ceiling until it is above the paper, while zooming at a linear rate so that the paper will eventually fill the rendered image. These actions occur simultaneously.

When doing this, an effect can be observed whereby the paper slides out of frame before it returns to centre. This is probably best explained visually, and kept to two dimensions:

img

This is not a good look. Consider the user requesting focus on something. Their conceptualization is that the entity is moving into view, and it is strange, then, that it appears to first move away before it comes closer.

The effect I wish for is of the target object only approaching the centre of the frame, and never retreating. I suppose the answer is to deform the rate of zoom somehow (or the rate of movement, though I would not prefer this) presumably as a function of the distances involved, or artificially adjust the zoom so the page is kept in frame. I would prefer help towards a solution along the lines of the former approach.


Update:

I think one answer might be to split the zoom part of the operation into two phases. Let the parameters of the problem inform a derivative function that yields the distance between the centres of target and viewport on the rendered output, and find the time at which this is the maximum. Do this for both axes and pick a time between the two: this is the boundary of the zoom phases. In the first phase, zoom to fit the paper just inside the boundary of the image. In the second phase, zoom to the paper to give the same result as before.

This intuitively seems better, but I still have two problems. I can doubtless find the equation for d at t, but my calculus is weak and I might end up sampling for the maximum rather than produce an inverse function to find it, which is what I'd really prefer. I also am not sure how to choose between the two maxima for finding the boundary time (although it may be that there is no 'right' answer to this question, and it is less of a worry to me). Any help with either problem, or any other insight into the broader challenge, will be very gratefully received.

0 投票
1 回答
730 浏览

html - 为什么我的 SVG 图像在嵌套在另一个 SVG 中时会被剪掉而不是调整大小?

我有一个 SVG,我想放在一个较小的盒子里,同时保留所有比率。我试图通过将 SVG 嵌套在另一个具有较小宽度/高度和视图框编号的 SVG 中来做到这一点,但不是调整大小,而是图像被剪掉。

我尝试将原始 SVG 嵌套在另一个具有不同视图框编号的 SVG 中。

原始 SVG

我试图把它嵌套在里面

预期结果:我希望原始 SVG 显示为自身的较小版本,并保留所有比率。实际:但是,图像不仅会调整大小,还会被剪掉。

0 投票
0 回答
74 浏览

svg - SVG 图像在某些屏幕中无法正确呈现

我们在使用 AMD 处理器的 Acer 机器中的 Chrome 中渲染 SVG 图像时看到了一个奇怪的问题。我们有一个 SVG 图像,它可以在大多数笔记本电脑屏幕上正确显示。

在 Acer(使用 AMD 处理器)中,SVG 文件在附加的图像顶部带有绿色补丁。

有没有人遇到过这种问题?任何指针或解决方案都受到高度赞赏。使成为

0 投票
2 回答
57 浏览

image-rendering - 优化图像加载以获得更好的用户体验

我必须制作一个网站,它可以一次渲染多个图像,就像一件衬衫,它有多个部分,如领子、袖子等。我必须一次组合所有这些图像并显示整件衬衫的图像。我怎样才能尽快做到这一点,为用户提供更好的体验?

0 投票
1 回答
475 浏览

swift - 如何在触摸时获取 UIImage 中特定像素的位置(或坐标)

在触摸图像时,我想获取该像素的坐标,我尝试了一些代码,但没有获得用户触摸图像的确切位置。

这是我现有的代码

0 投票
1 回答
46 浏览

ios - Wkwebview 无法在具有库目录路径的 html 中显示图像

我研究过类似的问题,但找不到解决方案。

我正在使用 WkWebView。它从库目录呈现一个 html,所以我做了 loadfileurl。

它有显示图像的选项,我们从图库/相机中选择图像,然后从图像数据中我们在库目录中创建一个文件并将路径发送到 web 。我尝试了两个路径 var/... 并附加了 file:// 两种情况图像都没有显示。请帮忙。任何建议表示赞赏。