PDA

View Full Version : PNG vs JPG


cafe
01-31-2017, 06:00 PM
When posting an image as an attachment, the upload window says that JPG, GIF and JPG are limited to 5 MB or 640x480 pixels.

That's clearly not what happens in practice. PNG images with a width over 640 pixels are resized to 640 pixels and converted to jpg while JPG images are left as is.

examples :

here are 2 PNG images (http://www.papermodelers.com/forum/569901-post39.html) originally in 2268 x 935 resized to 640 pixels wide and converted to jpg by the forum's software.

here are 2 jpg images (http://www.papermodelers.com/forum/569946-post10057.html). The bigger one is 1429 x 2048. The forum's software didn't resize them.
Why are PNG and JPG images treated differently ?

Let's see what happens to this 1081x361 pixels PNG image. (58.67 kb). Edit: resized to 640x214 and converted to JPG. The smaller image (506 x 320) is left alone.

I'm using png images because that's the format Inkscape uses for exporting bitmaps.

sjsquirrel
02-08-2017, 10:01 PM
Perhaps this little extension for Inkscape would be of interest to you.

https://github.com/giacmir/Inkscape-JPEG-export-extension

It exports the image and then automatically converts the PNG to JPG. Haven't tried it myself, so if you do I'd be curious to hear if works for you.

Steve

cafe
02-19-2017, 02:13 AM
Thank you but I don't really want to install a new program on my old laptop (this solution apparently require an extension for Inkscape and another program). I'll keep converting the png to JPG with xnview.

cfuruti
02-19-2017, 08:02 AM
...

It exports the image and then automatically converts the PNG to JPG. Haven't tried it myself, so if you do I'd be curious to hear if works for you.

Steve
As I understand, the point is not convenience for the poster, but PNG files being degraded to JPG automatically and without notice. JPG is especially bad for line art (usually a noisy swarm of pixels surrounds hard edges); if the number of colors is limited, even GIF is better.

db-sa
02-19-2017, 09:19 AM
.... The smaller image (506 x 320) is left alone.
And there is your answer.
Reduce your oversize pictures before posting.
Windows "Paint" will do that even if Inkscape will not.

Kugelfang
02-19-2017, 09:47 AM
I'm sure it's all about the image file size. *.jpg files typically use less memory than *.png files of the same dimensional size. But the trade off is that they sacrifice visual fidelity. E.g., you'll get pixelization. The theory is that jpg will blend similar colors but the human eye will compensate for the blurriness and you will still perceive the image--pretty much as intended. Consequently, jpg format is considered a 'lossy' format because you actually lose image data in order to achieve smaller file size. And once you further compress a *.jpg file, you can achieve quite small file sizes and maintain a reasonable representation of the image.

Png format is considered 'lossless'. You don't really lose image data. Png is generally better at compressing the file, though, so you can still achieve fairly small file sizes but without losing image quality. But png's more efficient compression does not quite match jpg's compression+lossiness in terms of created small file sizes.

Generally, when you are providing a service which provides imaging hosting (such as papermodelers.com does) You want to prioritize serving smaller sized image files rather than more image fidelity in larger sized files. Thus, the preference for jpg files. This reduces memory needed to store the files, as well as transmission speed from the server to the browser when a user views the image.

I would take the ' limited to 5 MB or 640x480 pixels' as very approximate ranges. Depending upon the number of colors in the image, the compression algorithm used, the file format, image resolution and pixel dimension the formula can be exceedingly fluid.


--jeff
(My, ain't I verbose this morning!)


BTW, the reason Inkscape favors png is that jpg is a proprietary format (or at least was, the rights may have expired by now). Inkscape, being fairly serious about its open source roots, avoids incorporating proprietary technologies.

cafe
02-19-2017, 10:31 AM
And there is your answer.
Reduce your oversize pictures before posting.
Windows "Paint" will do that even if Inkscape will not.

My issue is that the size restriction was relaxed for jpg, why not relax them too for png? Until a few months ago, you couldn't post a pdf as an attachment if it was over 200 kb, now the limit is 5 mb.

The original of the pic attached to this reply is a 2991 x 996 px PNG image of 521 kb. If I convert it to JPG with minimal quality loss it turns into a 644 kb file. If I choose the default 80% compression ratio, the resulting jpg is 237 kb but the image is now blurry. All 3 files are the same width/height.

rickstef
02-19-2017, 10:38 AM
We will take a look at the file size issue, and hopefully try to normalize the space allowed.

Rick

cafe
02-19-2017, 10:54 AM
Thank you Rick!

db-sa
02-19-2017, 11:46 AM
As far as I can make out from what I've downloaded, both jpg & png are currently limited to 800 pixels width but can have greater height than that.
pdf may be a better bet if you want to post larger images.

cafe
02-19-2017, 12:54 PM
The pictures I'm posting are previews in 300 dpi. The final version will be a vector pdf in the download area.

When I post a png file that's wider than 640 px, it's resized to that width and converted to jpg (see the 3rd pic in my previous comment). If I post a jpg, it isn't resized (see the first 2 pics, 2291 px wide).

rickstef
02-19-2017, 01:17 PM
I have a funny feeling that the resizing might be a forum software issue
http://vignette3.wikia.nocookie.net/poohadventures/images/8/8a/TF4_Optimus_truck.png/revision/latest?cb=20140628041417
the above image in png format has a dimension of 2200x1218
Normally the forum software resizes images down to a smaller resolution, like Carlos has mentioned, so this is a test to see what happens with an outside image link

rickstef
02-19-2017, 01:27 PM
Ok, I am starting to see where the problem might lie
Carlos has images linked as attachments, whereas I have a url link to an image.

I have uploaded the same truck image, and a screen shot of the manage attachment window, and both images were saved as png, and are uploaded as jpgs, and the attachment window also shows that there is a 5 MB limit on png files, maybe removing the size restrictions would help with maintaining the file type.
The truck should have been accepted as it was, it is only 3.60MB in size, so that shouldn't have been an issue

db-sa
02-19-2017, 01:40 PM
..... I'm posting are previews in 300 dpi. The final version will be a vector pdf in the download area.Does it matter if preview images are a little fuzzy? It's the quality in the download area that matters. If it does matter post you previews as pdfs in your messages. There they are limited only by file size not by the pixel size of any image they contain. Vector images in pdfs are not usualy very large anyway.


Don't worry folks I'm off to find a brickwall now.:confused::)

cfuruti
02-19-2017, 07:36 PM
Note: This is not relevant to the OP.


Png format is considered 'lossless'. ... Png is generally better at compressing the file, though, so you can still achieve fairly small file sizes but without losing image quality. But png's more efficient compression does not quite match jpg's compression+lossiness in terms of created small file sizes.
JPEG algorithms do best with uniform or smoothly blending colors (like painted textures or photographs, which have noise of their own): compression rates are very high, even at reasonable quality levels like 70, and the inevitable noise is less conspicuous. But when colors change abruptly, like with line art and text, PNG may compress better and never introduces noise (try it: draw hard edges on any raster editor, or just take a screen capture of your browser window right now, then save as JPG, and open the result. Zoom enough near text or sharp edges and you'll notice a swarm of pixels: they are inherent to the JPEG format, no matter your software).


BTW, the reason Inkscape favors png is that jpg is a proprietary format (or at least was, the rights may have expired by now). Inkscape, being fairly serious about its open source roots, avoids incorporating proprietary technologies.
Actually JPEG is standardized, and implemented by a free (as in freedom) library in Inkscape; however, it's probably patent-encumbered. IMHO a bigger factor is that each time a JPEG file is reopened and saved, quality degrades; changing a single pixel worsens the whole image.