image-manipulation

Reducing the file size of a very large images, without changing the image dimensions

雨燕双飞 提交于 2019-12-03 03:34:09
问题 Consider an application handling uploading of potentially very large PNG files. All uploaded files must be stored to disk for later retrieval. However, the PNG files can be up to 30 MB in size, but disk storage limitations gives a maximum per file size of 1 MB. The problem is to take an input PNG of file size up to 30 MB and produce an output PNG of file size below 1 MB. This operation will obviously be lossy - and reduction in image quality, colors, etc is not a problem. However, one thing

How do I do high quality scaling of a image?

末鹿安然 提交于 2019-12-03 02:03:29
问题 I'm writing some code to scale a 32 bit RGBA image in C/C++. I have written a few attempts that have been somewhat successful, but they're slow and most importantly the quality of the sized image is not acceptable. I compared the same image scaled by OpenGL (i.e. my video card) and my routine and it's miles apart in quality. I've Google Code Searched, scoured source trees of anything I thought would shed some light (SDL, Allegro, wxWidgets, CxImage, GD, ImageMagick, etc.) but usually their

How to efficiently and fast blur an image on the iPhone?

♀尐吖头ヾ 提交于 2019-12-03 00:47:48
If I have a UIImage or CGContextRef or the pure bitmap data (direct access to decompressed ARGB-8 pixels), what's my best option to blur an image with radius 10 pixels as fast as possible? Either use a stack blur, a box blur or use the OpenGL texture blur (google the first two, and check the Apple dev samples for the latter). tomsoft I've implemented a stackBlur algorithm for iOS, which is close to GaussianBlur but very fast: https://github.com/tomsoft1/StackBluriOS Check for instance here: Blur an UIImage on change of slider Rajesh Kumar https://github.com/rnystrom/RNBlurModalView -(UIImage *

Imagemagick thumbnail generation with php - using -crop

左心房为你撑大大i 提交于 2019-12-02 22:03:19
问题 Long ago I created a small library for resizing images using imagemagick through system(...) because I did not feel that the build-in imagemagick functions for PHP were sufficient. However, recently I had to port this to a symfony project and I chose to use sfThumbnailPlugin (if I remember correctly). This unfortunately didn't include the crop functionality - i.e. to specify a desired size, e.g. 300x300 px and have the thumbnail cropped so that it fit. I chose to implement this functionality

Write text onto image in Java

余生长醉 提交于 2019-12-02 20:39:27
Is there a Java library to write text to images, same as PHP's GD library . trashgod Here's is yet another example . 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.TYPE_INT_RGB); Graphics graphics = bufferedImage.getGraphics(); graphics.setColor(Color.LIGHT_GRAY);

App Engine Cropping to a Specific Width and Height

空扰寡人 提交于 2019-12-02 19:37:10
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 = img.width, img.height # We must determine if the image is portrait or landscape # Landscape if org

With ImageMagick, how can you see all available fonts?

我是研究僧i 提交于 2019-12-02 18:40:41
ImageMagick can draw text into a picture in a given font, how can I see all available fonts for my system? 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: # use fondu to convert fonts and update locatedb sudo port install fondu cd /usr/local/share/fonts/ fondu

Command line batch image cropping tool

混江龙づ霸主 提交于 2019-12-02 17:53:39
is there any lightweight command line batch image cropping tool(Linux or Windows) which can handle a variety of the formats ? Imagemagick is what you want -- tried and true. Ralph In Linux you can use mogrify -crop {Width}x{Height}+{X}+{Y} +repage image.png for CLI image manipulation Imagemagick's convert does the trick for me (and much more than cropping): convert -crop +100+10 in.jpg out.jpg crops 100 pixels off the left border, 10 pixels from the top. convert -crop -100+0 in.jpg out.jpg crops 100 pixels off the right, and so on. The Imagemagick website knows more: http://www.imagemagick.org

Layer image with opacity over the top of another image. - OpenCV

感情迁移 提交于 2019-12-02 17:35:27
问题 Edit Anybody with a similar problem - I found another SO answer here with a great python solution that exploits the speed of NumPy. Please consider the following problem: I have two images, both the same size. One is a red square with varying layers of opacity: And a second, a blue square, smaller than the red, with no opacity but white surrounding it. I am using OpenCV's python bindings for this project and so far (after reading about watermarking here I have this: redSquare = cv2.imread(

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

独自空忆成欢 提交于 2019-12-02 17:20:44
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 products will not be considered) tiffg4 is a black&white output device. You should use tiff24nc or tiff12nc as the output device colour PDFs - see ghostscript output devices . These will be uncompressed but you could put the resulting TIFFs through imagemagick or similar to resave as compressed TIFF.