LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

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

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


Hya,

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 libpng.org, sf.net... but no luck yet.

I appreciate any suggestion.

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

Rep: Reputation: 269Reputation: 269Reputation: 269
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
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

ImageMagick is your friend:
http://www.imagemagick.org

PS:
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:
http://www.michaelfurtman.com/pixels.htm

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
kaz2100
Senior Member
 
Registered: Apr 2005
Location: Penguin land, with apple, no gates
Distribution: Debian testing woody(32) sarge etch lenny squeeze(+64) wheezy jessie
Posts: 1,433

Original Poster
Rep: Reputation: 83
Hya,

Thanks, paulsm4. I found the solution in imagemagick. It was
Code:
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.
 
  


Reply

Tags
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 10:15 AM.

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