Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 06-04-2007, 04:01 PM   #1
Senior Member
Registered: Apr 2005
Location: Penguin land, with apple, no gates
Distribution: Debian testing woody(32) sarge etch lenny squeeze(+64) wheezy jessie stretch
Posts: 1,600

Rep: Reputation: 97
command line script to change resolution of png files


I am looking for command line script to change resolution of png files.

I have a lot of png files to change resolution for quality printing. I know how to do using application program, but too many.

These are what I have: 1280 x 960 png files (povray output), when I open them photoshop or some other applications, they are 72dpi.
I need these files to be 600dpi. Output format does not have to be png, but prefer to be png.

I checked, but no luck yet.

I appreciate any suggestion.

Happy Penguins!
Old 06-04-2007, 04:19 PM   #2
LQ Guru
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 271Reputation: 271Reputation: 271
How will increasing 72dpi to 600dpi increase the quality of these png's? The pictures were taken at some resolution. You can't really add resolution to a picture.

Think about it the other way. Pretend you have a picture at 600 ppi (pixels per inch). You want to reduce the resolution to 300 ppi. Basically what the program does is remove every other pixel. If you tried to go from 300 to 600 ppi, you have to add pixels. But what color should each pixel be? Should it just average the adjoining pixels? Should it just split the pixels so that there are twice as many? By increasing resolution, you're trying to add data points.
Old 06-04-2007, 07:12 PM   #3
LQ Guru
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

ImageMagick is your friend:

pljvalez is correct on both counts:
a) You can't "increase resolution" beyond what the picture was originally taken yet (let's not talk about image processing techniques - that's really not relevant to this discussion)

b) "dpi" (and, for that matter, "ppi") can be confusing. In this context, they really don't necessarily "mean" anything!

Here's a link that might help clarify:

But if you want to make the image "smaller" ... or "larger" ... or you want to "sharpen" it - or any of a million other things - then ImageMagick is definitely your tool!

Last edited by paulsm4; 06-04-2007 at 07:18 PM.
Old 06-04-2007, 07:53 PM   #4
Senior Member
Registered: Apr 2005
Location: Penguin land, with apple, no gates
Distribution: Debian testing woody(32) sarge etch lenny squeeze(+64) wheezy jessie stretch
Posts: 1,600

Original Poster
Rep: Reputation: 97

Thanks, paulsm4. I found the solution in imagemagick. It was
convert -units PixelsPerInch -density 600 inputFile.png outputFile.png
No data loss. Perfect.

Happy Penguins!

Last edited by kaz2100; 06-04-2007 at 07:55 PM.


png, resolution, script

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change Display Manager using command line. Which files to edit ? uncle-c Linux - Newbie 3 03-24-2007 05:28 AM
Need help with a short Linux command line script - working with split files bpmee Linux - Newbie 3 10-04-2006 02:08 AM
edit wav files via command line in a script legolin Linux - Software 4 12-21-2005 10:09 AM
change monitor resolution from command line gschrade Linux - Newbie 2 04-23-2004 03:57 PM
[command line] Resolution change in RedHat 8 asiemer Linux - General 1 07-01-2003 07:04 PM

All times are GMT -5. The time now is 09:46 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration