High quality JPEG compression with c#

The .Net encoder built-in to the library (at least the default Windows library provided by Microsoft) is pretty bad: http://b9dev.blogspot.com/2013/06/nets-built-in-jpeg-encoder-convenient.html Partial Update I’m now using an approach outlined here, that uses ImageMagick for the resize then jpegoptim for the final compression, with far better results. I realize that’s a partial answer but I’ll expand on …

Read more

How to create an animated GIF from JPEGs in Android (development)

See this solution. https://github.com/nbadal/android-gif-encoder It’s an Android version of this post. http://www.jappit.com/blog/2008/12/04/j2me-animated-gif-encoder/ To use this class, here is an example helper method to generate GIF byte array. Note here the getBitmapArray() function is a method to return all the Bitmap files in an image adapter at once. So the input is all the Bitmap files …

Read more

How to set the image quality while converting a canvas with the “toDataURL” method?

The second argument of the function is the quality. It ranges from 0.0 to 1.0 canvas.toDataURL(type,quality); Here you have extended information And I don’t think it’s possible to know the quality of the image once is converted. As you can see on this feedle the only information you get when printing the value on the …

Read more

Save inline SVG as JPEG/PNG/SVG

Nowadays this is pretty simple. The basic idea is: SVG to canvas canvas to dataUrl trigger download from dataUrl it actually works outside of the Stack Overflow snippet function triggerDownload(imgURI) { const a = document.createElement(‘a’); a.download = ‘MY_COOL_IMAGE.png’; // filename a.target=”_blank”; a.href = imgURI; // trigger download button // (set `bubbles` to false here. // …

Read more

How do you create a thumbnail image out of a JPEG in Java?

Image img = ImageIO.read(new File(“test.jpg”)).getScaledInstance(100, 100, BufferedImage.SCALE_SMOOTH); This will create a 100×100 pixels thumbnail as an Image object. If you want to write it back to disk simply convert the code to this: BufferedImage img = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB); img.createGraphics().drawImage(ImageIO.read(new File(“test.jpg”)).getScaledInstance(100, 100, Image.SCALE_SMOOTH),0,0,null); ImageIO.write(img, “jpg”, new File(“test_thumb.jpg”)); Also if you are concerned about speed …

Read more