Bigger file size after png resize

XnConvert Multi Platform - Windows, MacOSX, Linux
Post Reply
inezzz
Posts: 3
Joined: Fri Feb 21, 2014 2:43 pm

Bigger file size after png resize

Post by inezzz » Fri Feb 21, 2014 3:13 pm

Why do I get a bigger file size after decreasing the image size?

This is the base file:
http://s23.postimg.org/chc1had17/from.png
its size is 100.2 kB
after the resize: 179.8 kB
resample: lanczos

if I choose the "nearest neighbour" resample option, then the file size is smaller, but there is a huge quality loss.

kinda strange for me :shock: :D

User avatar
XnTriq
Moderator & Librarian
Posts: 5407
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Bigger file size after png resize

Post by XnTriq » Fri Feb 21, 2014 3:15 pm

Which file format did you choose for the result/output, inezzz?

cday
XnThusiast
Posts: 2065
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Bigger file size after png resize

Post by cday » Fri Feb 21, 2014 3:59 pm

XnTriq wrote:Which file format did you choose for the result/output, inezzz?
Which file format and compression method... ?

If your aim is to reduce the file size of the image, reducing the colour depth to 256 and resaving as a PNG with max compression results in a 30KB image with no obvious loss of quality.

If you do need to resize the image, what pixel or percent values do you need to resize to?

Edit: Image deleted because 30KB PNG file size expanded to 242KB when uploaded -- uncompressed ??

inezzz
Posts: 3
Joined: Fri Feb 21, 2014 2:43 pm

Re: Bigger file size after png resize

Post by inezzz » Fri Feb 21, 2014 4:27 pm

Thank you for the answers!

I left the "Format" at "as original". If I change it now to PNG, the compression level is at 6. It looks like even if I change the compression level to 9 it is only a small change in file size.

However, that color depth change makes a huge impact. This is a great trick! I see the quality loss at the top of the image, but still pretty good.

These are the results:
result size(this is the needed size): 580x600
PNG6: 179.8 kB
PNG9: 178.2 kB
PNG6+color256: 60.7 kB
PNG9+color256: 59.2 kB

How did you make that 30kB? :)

If you know any similar tricks to optimize the image size, please let me know :P

cday
XnThusiast
Posts: 2065
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Bigger file size after png resize

Post by cday » Fri Feb 21, 2014 5:01 pm

inezzz wrote:If I now choose the PNG, the compression level is at 6. It looks like even if I change the compression level to 9 it is only a small change in file size.
That's my experience too, and the image properties for both images show the compression method as ZIP, but using a compression level of 9 presumably adds a small extra optimisation.
inezzz wrote:That color depth change makes a huge impact ... I see the quality loss at the top of the image, but still pretty good.
Reducing the colour depth can often be effective for the type of image that is saved as a PNG, and it is actually possible to reduce to much less than 256 colour. But it probably wouldn't work well for a photo, although in any case the JPEG format only supports 24-bit and grayscale depths.

I didn't notice the quality loss at the top of the image at a quick look, but I thought that the large black text looked better!
inezzz wrote:How did you make that 30kB? :)
I actually used XnView Classic for my quick test: Image > Convert to Colours... > 256 and then saved as a PNG with level 9 compression.

The equivalent in XnConvert is Image > Change color depth (which seems a better name...) and you can see that it is possible to reduce the colour depth in steps down to as few as 8 colours, if necessary, so you could experiment with lower values if you wish.

I'll leave you to experiment with the 580x600 pixel image you need.
Last edited by cday on Fri Feb 21, 2014 5:37 pm, edited 1 time in total.

User avatar
XnTriq
Moderator & Librarian
Posts: 5407
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Bigger file size after png resize

Post by XnTriq » Fri Feb 21, 2014 5:30 pm

I've resized from.png with XnView/XnConvert (Lanczos) to 580×600 pixels and tried to reduce the file size of the resulting PNG (204'645 bytes) without reducing the color depth:
p117585.png
TinyPNG.com (255 colors)
p117585.png (65.22 KiB) Viewed 2434 times

inezzz
Posts: 3
Joined: Fri Feb 21, 2014 2:43 pm

Re: Bigger file size after png resize

Post by inezzz » Fri Feb 21, 2014 6:32 pm

Hmm, I'm a bit confused! does this mean that somehow XnConvert is less effective than XnView? :? (unfortunately I use linux so I can't use the classic XnView)

(ty for the links)

cday
XnThusiast
Posts: 2065
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Bigger file size after png resize

Post by cday » Fri Feb 21, 2014 9:11 pm

inezzz wrote: ... does this mean that somehow XnConvert is less effective than XnView?
I don't think so if the optimum settings are used: I've now managed to use XnConvert to reduce your image to 256 colours and obtain the same 30KB file size as before:
from_XnConvert_256.zip
(29.24 KiB) Downloaded 64 times
I used the following XnConvert settings:
XnConvert_1.png
XnConvert_2.png
XnConvert_2.png (8.92 KiB) Viewed 2419 times
I'm not sure whether Dithering -- None and Filter -- None are actually the ideal settings but they give you a basis for any further tests you may wish to make.

Adding a Resize step seemed to increase the file size, which seems counter intuitive as the resulting image has smaller pixel dimensions, but possibly results from an increase in complexity in the image. Note that the 580 x 600 pixel size image you wish to create has a slightly different aspect ratio from your orignal image, and that selecting or not selecting 'Keep ratio' affects the image produced, so you may need to examine that. Edit: use 'not selected' to obtain the pixel dimensions entered.

Also note that the Resize step produces a 24-bit colour image, and so the reduction in colour depth to 256 colours must be the final step.


User avatar
oops66
XnThusiast
Posts: 1999
Joined: Tue Jul 17, 2007 1:17 am
Location: France

Re: Bigger file size after png resize

Post by oops66 » Sun Feb 23, 2014 2:02 pm

inezzz wrote:... (unfortunately I use linux so I can't use the classic XnView)...
hello, ... yes you can ... via WINE ;-) http://www.winehq.org/
... also ... You can also use from XnViewMP under: tools\export... png settings on the fly ("Auto refresh" ...to check the size on the fly) ... then use XnViewMP "Batch Convert" ... or XnConvert or NConvert ;-)
XnViewMP 0.82 Linux X64 - Ubuntu 16.04 LTS - X64

Post Reply