How to save a PNG as a smaller file but at the same resolution?

21,743

Solution 1

  • Do not re-save as JPG (or do once as much, at hi quality). Every time you do it, you add new quality loss. Work in PNG format, and only if you need it, save last version as JPG.

  • tweakPNG tool allows you to remove extra data, but beware not removing essential data(this is not a compressing tool). For compressing it well, I agree on using PNGcrush. I my tests, got the best compression.(there are others: PNGauntlet, Optipng, etc)

  • be sure on why you need to keep 300dpi, that is only needed if you are going to print. Anyway, if you need a lot of detail, reducing it is like reducing pixel detail, and that can be not convenient.(in this case, quite detail needed, but not for print, just reducing to 150 or 200dpi every file might work to keep all objects at same size between files)

  • You mention that the "object size in the picture must remain the same". If you were to publish all this only in screen based media, not print, and you reduced all images only in dpi, that is, going from 300dpi, to 72dpi, all objects will be in same proportion(and screens are 72 or 96dpi. Using 300dpi is ok, though). To be able to do this, you can use Photoshop (best) , or even the free irfanview converter(its batch mode would become incredibly handy), download from irfanview.com.

  • PNG does not preserve DPI info, tho won't lose pixel data and you will be able to restore it with Photoshop. If you need it maintaining the DPIs because target user is not a designer or graphic artist(does not know how to create a 300dpi document from a file with just pixels info), then you'd better use TIFF format, good for print, supporting transparency and DPIs. But you will need to compress it quite with 7zip, winrar, Winzip or the like. (if you need to send it by mail, etc)

  • To check you are not losing info, just be sure pixel dimensions keep the same.(and no jpg saving is done)

Replying to your updated answer :

  1. rotate the image

usually a flip (vertical or horizontal) or 90º rotation command, wont add detail loss. Rotating manually with other tools, can add loss, like most operations.

  1. make the white surroundings transparent (know how to do that)
  2. make the file size less than 4MB. Preserving the quality as much as possible

I am a bit surprised about the need of working like this for t-shirts printing. Firstly, the usual both ways of delivering the design to them tends to be a) a vectorial file, be it EPS, freehand, (even SVG in some cases) etc. In one color or 2, 4, etc... b) A raster RGB file, or CMYK, in both cases, usually a JPG. Not neededly using 300dpi, indeed, in cloth, it's often 200dpi, or 150dpi, depending on the material. In a traditional print company, you would never see a flower that you physically want to be, ie, 20cm, to be printed smaller, provided that you knew the resolution (dpi) at which they print, and even choosing another output if possible. I suspect there is a format, manner or way to tell your t-shirt company to receive the files at lower DPI, but same size in inches or CMS. Probably in another "mode" or the like. If you provide us (if are allowed) the name of the company, I could tell you some direction on how to do this, as they'll refer that in their doc.

Other thing that sounds strange to me is the whole transparency thing, which forces you to use PNG. If you are going to print on white cloth, then just use pure white, most print machines will just disregard the white as background, no ink. So JPG would be possible, and certainly way smaller size in MB.

There's another way, that is providing them the design in eps vectorial format. (not "raster" eps). That'd be really small in Ks. Obviously your friend just draw traditionally, and you would be forced to trace manually or automatically her design. Which is technically quite complex to do it well not being a designer. (and could happen your friend wouldn't like the output)

Talk to the guys, mail or their forums, and first of all , check their doc, it absolutely have to be possible to just use JPG (often in CMYK mode) using a solid color background(white, or a cyan if cloth is cyan, etc), and surely at smaller dpi (that is: if you send a 200 dpi file, and their printing "mode" or flavor is 200dpi, the object shows in the t-shirt same size than if you send them same design at 300dpi, and their machine prints at 300dpi, provided you gave them all times files haivng same cm (or inches) dimensions, althought at diferent resolutions(dpi). I'd be surprised to know they print only (and in cloth) at 300dpi...)

Ok, seing the time I dedicated to this question, now I am curious. If you can, just post the url of the company, might be much shorter path ;)

Update: Info to work with that site.

Firstly, seems, as I was suspecting, that you don't need all this stuff of the transparency and PNG. And so, can use just JPG. IMHO you just need to be sure you delete and make white all the dirt,etc, from the scanning. Often, a fast way to do it, is in Photoshop , "Color Selective", then adjust "whites", and remove all "black" in that "whites" slider. As you are using gimp, a trick can be lowering to the left the white tiny slider in the "Levels" (colors top menu) dialog, and just touching that. Not much, though. Will lose some detail, but not much. Tho is preferable to delete the white dirt with other methods, that protect more the drawing.

So, they actually have a procedure, you just make sure you leave that white background quite clean,(fully white) and just send them it as JPG, (don't work on transparency neither do a PNG), at 300dpi, same size in cm or inches (same pixels numbers) you were working initially, and inform as they say, that you want it "transparent" in the way they mention in the bellow FAQ URL:

http://www.pistolclothing.com.au/faq26

OK, IMHO, all you have to do is save as JPG, at 300dpi which is the res you had been sending to them. Compressing as JPG, should be able to give you the good size/quality ratio. Reading more:

"We print all artworks in CMYK full colour"

But you work with Gimp, and at least in the Windows version I think there's not yet CMYK mode. But surely the guys do a good job on printing it somehow. As is what average user will send them, close to no user knows what cmyk is.

"We print all images at 300 DPI " there you have it. Use that.

"We accept: JPG, GIF, PNG, PDF, EPS, TIFF, Adobe Illustrator, Adobe Photoshop formats"

"To get a good full sized quality print, its best to use your image artwork at an A4 size canvas"

"Please also check that your image is in an RGB mode. Sometime's an artwork that's in CMYK may not display correctly in your browser. Check the file size is below 20 MB"

See? They actually have it ironed to deal with RGB images. So, no much worries... BTW, being your image 14 megs, it should have worked... But from now, works as told you, JPG, solid white background, no work on transparency (indeed, will be a JPG)

That's all. Give it a try doing as I explained you, might make it all much easier and faster ;)

Solution 2

Try the Smush.it image optimization tool.

It is a "lossless" tool, which means it optimizes the images without changing their look or visual quality.

Solution 3

PNG is a lossless format, while JPEG is lossy. So its unlikely that saving as PNG will give you smaller file size.

You could try one of the following. These will help reduce the size no matter what the format:

  1. Reduce color depth

  2. Reduce DPI

  3. Reduce JPEG quality (above 90% quality has very little affect on the picture but increases picture size substantially). If you want PNG only, still reduce the JPEG quality first to see if it reduces the final PNG size.

Of course, remember to backup your original image first :).

Solution 4

You could try pngcrush, which is a command line tool to optimize PNG file sizes.

Its main purpose is to reduce the size of the PNG IDAT datastream by trying various compression levels and PNG filter methods

Again, this is a lossless compressor, and I believe is actually what smush.it (mentioned in mvark's answer) uses behind the scenes.

Solution 5

Without using any special tools, you can reduce a PNG's file size by making sure it's not interlaced.

Additionally, you can use indexed colors and reduce the color palette (always use a local palette rather than a standard palette). Depending on the type of image it is, you could reduce it to 256 colors or even less without much perceptible difference (for gray-scale images, I've reduced it to 180 colors using the proper settings without any noticeable degradation in quality). You'll want to enable dithering though. If there are gradients that show banding, then use "noise" as the dithering mode (as opposed to pattern or diffusion).

Also, when you use indexed colors, don't force any colors (including transparent, unless you need it). And the palette type does matter. In my experience, using a perceptual palette can reduce the file size by about 1/3rd. On the other hand, "adaptive" is the worst local palette.

Of course, all of this presupposes that PNG is the right compression format for the image in question. If it's a photo-type image, then you should just go with the proper compression method and use JPEG, as that's what it's designed for.

Share:
21,743

Related videos on Youtube

Radek
Author by

Radek

Updated on September 17, 2022

Comments

  • Radek
    Radek over 1 year

    not sure what stackexchange site is the best for this question.

    I have a scanned jpg file with below properties and size 8.5MB

    pixel dimension: 2468 × 3484 pixels
    print size: 208.96 × 294.98 millimeters
    resolution: 300 × 300 ppi
    

    I need to save the file as png (to have the pic transparent) while the size cannot be bigger than 4MB. The most important is that the size of picture must remain the same. I mean that the object size in the picture must stay the same.

    Could anybody tell me what is used to define the size of the objects in the picture?

    I use Gimp to edit the file.

    UPDATE

    SO what is happening is that a friend of my is an 'artist'. She draws a picture and scans it as jpg and send it to me. Then I work on it little bit ( get rid of some stuff that happened to be in the pic because of the scanning and making transparent what needs to be transparent) and then I send the final file to the printer company to be printed on a T-shirt.

    Last time I did mess it up (no idea what I did wrong) or the printing company so the objects on the T-shirt were bigger than the original one. Of course my friend didn't like that. So I finding our what I have to careful about so it will not happen again. The printing company accepts files in size less than 4MB but her pictures are always bigger than that.

    UPDATE II

    Thank you for the advices. The last jpg file is 8MB big. The picture looks like that. Almost full A4 size. I need to (the best in gimp or some other free tool)

    1. get rid of the black line at the top (I know how to do that)
    2. rotate the image
    3. make the white surroundings transparent (know how to do that)
    4. make the file size less than 4MB. Preserving the quality as much as possible

    when I save png with points 1. & 3. done as png in gimp the file size is 14.8MB

    looks

    • franji1
      franji1 over 13 years
      Hey... I updated my answer with quite some content, for replying your also updated question here. Be sure to check it, with some luck it'll make your workflow much better. And the link of the place I mention there, if possible.
    • franji1
      franji1 over 13 years
      updated with site's info, you don't need pngs, as I was suspecting :) Just search for "Update: Info to work with that site." in my answer...
    • Day
      Day over 13 years
      The first version of this question didn't mention printing images on T-shirts. Most answers, including mine are about making images smaller for serving from a website, which seems fair given this is webmasters.stackexchange.com. I'm not sure this question really belongs here any more, given it's current form. One for superuser?
  • Radek
    Radek over 13 years
    @JP19: cool.Thank you,I'll try that. I was playing with 'scale image' which I guess wasn't the right thing ...
  • astro11
    astro11 over 13 years
    Also, PNG has compressiong levels from 1 to 9 (9 means max compression).
  • Admin
    Admin over 13 years
    Forgot about this one...I have had good experience with pngcrush! Recommended!
  • Lèse majesté
    Lèse majesté over 13 years
    Some good advice, but what do you mean by "PNG does not preserve DPI info"?
  • franji1
    franji1 over 13 years
    True (just edited). PNG does preserve it (pHYs png chunk). Though there are some issues in some cases, and also, depending on the software and person handling it, there can appear some probs. It's why I almost mechanically tend to recommend TIFF, eps, psd... Good catch.
  • Radek
    Radek over 13 years
    just quickly .... first of all thank you so much for your time. The company's url is pistolclothing.com.au I guess I need the transparency as the color of the t-shirt could be any and I do not want to print what is scanned. I am not a designer at all so I might not be right :-)
  • Radek
    Radek over 13 years
    @S.gfx: could changing of DPI somehow result in a change of size of the objects in the picture?
  • franji1
    franji1 over 13 years
    You're welcome :) . Yes, it can end in a change of the objects, because if they print at 300dpi, and you sent an image at 300 dpi, and later you send them one at 200 dpi, and they actually keep printing (ie, because is how they print) at 300 dpi, I guess the change, the transformation of your image -> 300dpi, will be done just using the pixels information, so, resulting in an smaller object in inches. I will let you know of what can you do after looking at that site, some minutes later(doing other stuff right now ;) ).
  • franji1
    franji1 over 13 years
    This is a very good advice for certain type of images/graphics for web output, but for printing output, in general, should not be done :) ;) (the dithering will be quite visible once is printed)
  • Radek
    Radek over 13 years
    @S.gfx: thank you for all the research. Still not sure about the transparency. Would 'your way' work if printing on any color of t-shirt? What if the transparency is in the middle of the art work? If I upload the artwork it says that it shouldn't be bigger than 4MB. I guess I was lowering DPI last time and the artwork got bigger :-(
  • franji1
    franji1 over 13 years
    I guess the best way to know is asking them to a support email, that matter of if they will be able to consider transparency in the insides. Actually can be a problem if there's same color on the drawing, ie, white, equal to the background. But I suspect they are not just wiping out a color, not just that, they're probably doing sth similar to what you do. It says no more than 4mb, but FAQ says 20MB. I'd ask that question as well ;)
  • franji1
    franji1 over 13 years
    If you reduce the dpi, the artwork should get smaller, as is usually less pixels information(but if only changed dpi, no resample, the inches might have increased). Unless they actually print at 200dpi if your file is so (would sound strange to me that tehy'd print at any dpi).In that case, if the number of pixels did not decrease, yep, sth got increased in your side, so, the cm/inches size, you might have increased that. What you can do is a test with png and transparency, and actually try to upload, see what happens. Anyway, contacting them for your case might be convenient.
  • Day
    Day over 13 years
    @S.gfx The first version of this question, to which Lèse majesté provided this answer, didn't talk about printing at all. I think Lèse majesté must have assumed, as I did in my answer, that the OP wanted to make images smaller for serving from a website, given this is webmasters.stackexchange.com. Not sure the question really belongs here any more in it's current form