Is there a way to tell browsers to honor the jpeg exif orientation?

CSS image-orientation: from-image from the specs https://www.w3.org/TR/css4-images/#the-image-orientation 6.2. Orienting an Image on the Page: the ‘image-orientation’ property image-orientation: from-image from-image: If the image has an orientation specified in its metadata, such as EXIF, this value computes to the angle that the metadata specifies is necessary to correctly orient the image. If necessary, this angle is … 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

Enabling JPEG support for QImage in py2exe-compiled Python scripts?

After hours of stumbling around with the same issue, I’d like to share the solution that worked for me on windows vista: using python2.6 copy the following directory into your dist directory generated by py2exe: C:\Python26\Lib\site-packages\PyQt4\plugins\imageformats I just dropped the imageformats directory directly into my dist directory, without any further modifications to qt.conf or anything … Read more

Determining JPG quality in Python (PIL)

In PIL (and mostly all softwares/librairies that use libjpeg) the quality setting is use to construct the quantization table (ref.). In libjpeg the quality number “scale” the sample table values (from the JPEG specification Section K.1). In other librairies there’s different tables assign to different qualities (ex.: Photoshop, digital camera). So, in others terms, the … Read more

Detect end of file for JPG images

Well, there’s no guarantee that you won’t find FFD9 within a jpeg image. The best way you can find the end of a jpeg image is to parse it. Every marker, except for FFD0 to FFD9 and FF01(reserved), is immediately followed by a length specifier that will give you the length of that marker segment, … 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