Pasting an Image from the clipboard works fine, but seemingly it’s stored as TIFF. Is there any way to store it as JPEG? With TinyMCE?
Related
For many images, this code works fine to convert a PNG image to JPG:
Thumbnails.of(pngIn)
.outputFormat("jpg")
.scale(1.0)
.toFile(jpgOut);
But for this specific image:
the code results in an all-white JPG image. If someone can point me to the right way of doing things in Thumbnailator, I would very much appreciate it. Cheers!
EDIT: Well, something in the image upload / download process makes things work for the attached image! (The downloaded image is 50K while the original image is 41K, so clearly there's some funkiness going on there.) But I promise that the original PNG really does not work.
EDIT 2: This link to Google images can be used to download the 920x900 PNGWing image (41K) on the right side of the page.
The above syntax seems to be correct for converting PNG to JPG. The problem is that when the referenced image is read into a BufferedImage object, the image's type is BufferedImage.TYPE_BYTE_BINARY. While such images can be 1, 2, or 4-bit images, Thumbnailator doesn't handle 2- or 4-bit images correctly, essentially assuming that the image is a 1-bit image.
In short: the syntax is correct, but there appears to be a Thumbnailator bug that hinders successful processing of some PNG files.
I would like to compress png files on my site. I found ImageOptim program. For jpeg files it works great, but when I compressed png files it displayed incorrectly on the site (part of the picture is cut off).
My question is how to make it work in browsers? I see that ImageOptim uses several tools for png compressing(PNGOUT,OPTIpng etc).Maybe I should set some specific tool?
I recommend using JPEG & PNG Stripper.
You can either drag and drop your image files to the GUI or use it as a command line tool.
I realize that PNG is normally the web standard, but I might have a bit of a unique situation. I'm building an app that downloads lots of images from a server. The download needs to be as quick as possible, especially over 3G connections. I've been looking into the best compression for the images on the server. Ideally, every image I use can be quickly resized for the app using a drag and drop converter of some sort. When I convert one of the images to a PNG, the file size is around 130KB. When converted to an acceptable JPG quality however, the file size comes in at well under 50KB. Should I use JPGs in the application?
Thanks in advance,
It actually depends on the type of images.
The basic rule is to use JPEG for photos and PNG for everything else.
Why is it so?
JPEG compression is designed for photos - photos can handle lossy compression. On the other hand, PNG is compression designed for images which have similar pixels close to each other (straight lines, areas filled with one color, texts, etc.). If you try to use JPEG on an image which is not a photo, you'll be surprised - it won't look very good.
PNG is a standard - but for icons, backgrounds, patterns etc; not for photos.
Yes you can use jpg. You will not encounter any problem. It is a tradeoff between quality and size. Jpeg is usually smaller because it is compressed so as to reduce size. Png is lossless compressed.
I have made applications that use both png and jpeg and they both work like a charm.
EDIT: You can also check out this link PNG vs JPEG
PNG images are huge in size, use JPG as long as it's possible (when you don't need transparency)
When I click on the image>property>details of a PNG image in Windows many fields are missing compared to a JPEG file. Are these fields supported in PNG? If so, how would they be added in a PNG file programmatically?
section 11.3.4.2 of the PNG spec gives a list of pre-defined meta tags (keywords)
http://www.w3.org/TR/PNG/#11textinfo
you can add as many other meta tags/fields as you would like.
as for how, programmatically, that depends on the language you're using!
PNG has no EXIF chunk. Thus EXIF metadata will get lost if you convert from JPEG into PNG.
However Adobe has made XMP for storing all kinds of metadata. So that you can convert between JPEG and PNG while preserving metadata.
Using GWT I would like to read a PNG image and have the data accessible to me as a decoded byte array.
On the client side I get the image using an ImageBundle, I then instantiate an Image and call setUrl.
At this point, how do I get the image byte array from the image?
You can't. Javascript (and hence GWT) do not have access to images' data when images are presented as html images (i.e. as <img> tag or css background image).
What you could do is load image data via RPC, process it, Base64 encode it and then create image via embedded url: "data:image/png;base64,..yourBase64Datahere.."
If you are trying to do some visual manipulation you should consider:
Manipulating image on the server.
Using html canvas or svg.