LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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: SlackWare > Debian testing woody(32) sarge etch lenny squeeze(+64) wheezy .. bullseye bookworm
Posts: 1,832

Rep: Reputation: 108Reputation: 108
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
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
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
LQ 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: SlackWare > Debian testing woody(32) sarge etch lenny squeeze(+64) wheezy .. bullseye bookworm
Posts: 1,832

Original Poster
Rep: Reputation: 108Reputation: 108
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



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

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:37 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration