image-manipulation

Resize an image and fill gaps of proportions with a color

廉价感情. 提交于 2019-12-03 09:00:47
I am uploading logos to my system, and they need to fix in a 60x60 pixel box. I have all the code to resize it proportionately, and that's not a problem. My 454x292px image becomes 60x38. The thing is, I need the picture to be 60x60, meaning I want to pad the top and bottom with white each (I can fill the rectangle with the color). The theory is I create a white rectangle, 60x60, then I copy the image and resize it to 60x38 and put it in my white rectangle, starting 11px from the top (which adds up to the 22px of total padding that I need. I would post my code but it's decently long, though I

How to implement despeckle in OpenCV?

五迷三道 提交于 2019-12-03 07:45:06
If histogram equalization is done on a poorly-contrasted image then its features become more visible. However there is also a large amount of grains/speckles/noise. using blurring functions already available in OpenCV is not desirable - i'll be doing text-detection on the image later on and the letters will get unrecognizable. So what are the preprocessing techniques that should be applied? Michael Koval Standard blur techniques that convolve the image with a kernel (e.g. Gaussian blur, box filter, etc) act as a low-pass filter and distort the high-frequency text. If you have not done so

Losing colors when resizing jpegs in Java (tried with multiple libraries)

北城以北 提交于 2019-12-03 07:21:16
I've tried multiple image resizing libraries posted here on SO, as well as with raw java using getScaledInstance . While everything works most of the time, there are two jpeg images for which the colors are always messed up whenever I resize them. First image: Result: Second image: Result: I've tried these images with multiple libraries including Scalr, Thumbnailator, and raw java using image.getScaledInstance() (see here for code), but the result is the same. Any ideas what the problem is? Click Upvote I've found a solution, with a lot of help from this answer : import java.awt.Graphics2D;

Write text onto image in Java

时光毁灭记忆、已成空白 提交于 2019-12-03 06:53:23
问题 Is there a Java library to write text to images, same as PHP's GD library. 回答1: Here's is yet another example. 回答2: Try the below code import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; public class Testing { public static void main(String arg[]) throws IOException { String key = "Sample"; BufferedImage bufferedImage = new BufferedImage(170, 30, BufferedImage

App Engine Cropping to a Specific Width and Height

六月ゝ 毕业季﹏ 提交于 2019-12-03 06:15:21
问题 I need to resize and crop an image to a specific width and height. I was able to construct a method that will create a square thumbnail, but I'm unsure on how to apply this, when the desired thumbnail is not square. def rescale(data, width, height): """Rescale the given image, optionally cropping it to make sure the result image has the specified width and height.""" from google.appengine.api import images new_width = width new_height = height img = images.Image(data) org_width, org_height =

Manipulate WebP images in Python

末鹿安然 提交于 2019-12-03 06:02:57
I'm looking for something like PIL (Python Imaging Library), which sadly doesn't support WebP images. I'd like to be able to do resizes and crops. Or at least convert to JPEG and then I can work it with PIL. Take a look at: http://code.google.com/p/python-webm/ I was able to walk through the test file to see how they were doing it. imagemagick's convert tool , version 6.5.7-8 or better, can manipulate WebP images . Also, Google provides an encoder and decoder for Linux, Windows and Mac OS X. 来源: https://stackoverflow.com/questions/6876502/manipulate-webp-images-in-python

How do I draw an image based on a simple polygon?

微笑、不失礼 提交于 2019-12-03 05:56:58
问题 I'd like to copy a roughly rectangular area to a rectangular area. Example: Both areas are defined by their corner points. The general direction is kept (no flipping etc). Simply rotating the source image does not work since opposing sides may be of different length. So far I found no way to do this in pure C# (except manual pixel copying), so I guess I have to resort to the Windows API or some 3rd party library? 回答1: Generally speaking, what you want to do is map the destination coordinates

How to convert XCF to PNG using GIMP from the command-line?

末鹿安然 提交于 2019-12-03 05:36:22
问题 As part of my build process I need to convert a number of XCF (GIMP's native format) images into PNG format. I'm sure this should be possible using GIMP's batch mode, but I have forgotten all of the script-fu I used to know. My input images have multiple layers, so I need the batch mode equivalent of "merge visible layers" followed by "save as PNG". Also note that I can't install anything in ~/.gimp*/scripts/ — I need a self-contained command-line, or a way to install scripts in my source

With ImageMagick, how can you see all available fonts?

家住魔仙堡 提交于 2019-12-03 04:42:38
问题 ImageMagick can draw text into a picture in a given font, how can I see all available fonts for my system? 回答1: depending on your imagemagick version: convert -list type # for IM older than v6.3.5-7 convert -list font # for newer versions also the output format changed... -- update For OsX (Answer from Charles Merriam) if the command above does not produce any results: For a full tutorial with description see http://gothick.org.uk/2008/03/14/using-os-x-fonts-in-imagemagick/ for the rest &tldr

Ghostscript PDF -> TIFF conversion is awful for me, people rave about it, I alone look sullen [closed]

断了今生、忘了曾经 提交于 2019-12-03 03:57:06
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 4 years ago . My stomach churns when I see this kind of output. http://www.freeimagehosting.net/uploads/e1097a5a10.jpg and this was my command as suggested by Best way to convert pdf files to tiff files gswin32c.exe -q -dNOPAUSE -sDEVICE=tiffg4 -sOutputFile=a.tif a.pdf -c quit What am I doing wrong? (commercial