LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-05-2010, 05:56 AM   #1
ts4053
LQ Newbie
 
Registered: Jan 2010
Posts: 1

Rep: Reputation: 0
How to resize image in CLI with keeping palette and type as original


Hi,

I'm trying to resize image for mplayer overlay usage. I'm using "convert -resize" from Imagemagick. My problem is that after resize image doesn't have the original color depth nor palette.

Code:
convert logo1.png -resize 200 PNG8:logo2.png
I'm able to resize image correctly if I manually set depth and type, but this is not working when I have to resize images with different palettes.

Code:
convert -depth 8 -type PaletteMatte logo1.png -resize 200 PNG8:logo2.png
Is there any CLI tool or specific convert option to resize image with keeping all the other image related setting as original?

Br,

-Timo-
 
Old 01-05-2010, 08:35 AM   #2
kunstkopf
LQ Newbie
 
Registered: Mar 2009
Posts: 4

Rep: Reputation: 0
Resizing is not simple

Image scaling is not at all a trivial thing.
Due to interpolation, the color table for the result
cannot be the same as that of the input. The trick
is not to use palette-based images in the first place.

In professional applications, the mother images are
kept in super quality (3x8 RGB) and all the web-faced
derivatives of the mother image are in some reduced or
mangled form (jpg,png). I did not even know palette-based png
existed. The extermination of GIF with its simple color table
apparently has not exterminated that bad habit.

You may want to use the netpbm package for storing images in
raw RGB format (.ppm). You can rescale (and re-palette if you want)
in whatever way you like, then use ImageMagick convert to
get at the required output format.

Also: consider jpeg: if resizing is your thrill, .jpg
is more convenient and better than .png. A JPEG which is
live resized via html < img src = is neater in many browsers
than a resized png.

Look for:
pnmscale
pnmcolormap
pnmremap
pnmquant
pnmdepth
(etc.)
 
  


Reply



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
Finding the original image from .thumbnail TuxLives Linux - Desktop 1 09-05-2007 08:28 AM
Need to reload NAS while keeping original timestamps New2Linux2 Linux - General 2 06-19-2007 05:13 PM
How to resize filesystem (image file)? how to truncate the image? nikov3 Linux - General 4 06-27-2006 03:02 AM
a need simple a program to resize images while keeping the aspect ratio Necronomicom Linux - Software 3 07-10-2004 12:21 AM
Linux distro to learn CLI while keeping XP? babyphil Linux - Distributions 5 06-08-2004 04:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:50 AM.

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