How do I convert tiff to jpeg and remove a layer

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
darkshadow

How do I convert tiff to jpeg and remove a layer

Post by darkshadow »

I am working on command to automatically resize and convert a directory of tiff's from a digital camera to jpeg's but the pictures have 2 layers one being the picture and one being a thumbnail. When I resize it also resizes the thumbnail and then that ruins the picture. Since all it is, is a resized thumbnail that is viewable.

Here is my scripts
#######
for i in `ls -C1 *.TIF`
do
convert -verbose -resize 1280x960 $i $i.jpg
done
#######

Here is the programs output
#######
TIFF Directory at offset 0x8 (8)
Image Width: 3296 Image Length: 2472
Resolution: 72, 72 pixels/inch
Bits/Sample: 8
Compression Scheme: None
Photometric Interpretation: RGB color
YCbCr Positioning: cosited
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 3
Rows/Strip: 1
Planar Configuration: single image plane
ImageDescription: DIGITAL CAMERA
Make: CAMERA
Model: 8MP-9U4
Software: V1.06AK
DateTime: 2007:03:02 06:29:51
EXIFIFDOffset: 340
TIFF Directory at offset 0x2a2a (10794)
Image Width: 160 Image Length: 120
Resolution: 72, 72 pixels/inch
Bits/Sample: 8
Compression Scheme: None
Photometric Interpretation: RGB color
Samples/Pixel: 3
Rows/Strip: 17
Planar Configuration: single image plane
PICT0250.TIF[0] TIFF 3296x2472 DirectClass 23.4mb
PICT0250.TIF[1] TIFF 160x120 DirectClass 23.4mb
PICT0250.TIF TIFF 3296x2472=>1280x960 DirectClass 23.4mb 1.280u 0:03
PICT0250.TIF[1] TIFF 160x120=>1280x960 DirectClass 23.4mb
PICT0250.TIF=>PICT0250.jpg[0] TIFF 3296x2472=>1280x960 DirectClass 792kb 0.500u 0:02
PICT0250.TIF=>PICT0250.jpg[1] TIFF 160x120=>1280x960 DirectClass 352kb 0.320u 0:02
darkshadow

Re: How do I convert tiff to jpeg and remove a layer

Post by darkshadow »

I have a partial workaround to my problem but would still like to know how to automatically get rid of the thumbnail. I now get a good picture but with the thumbnail still visible but smaller.
I just do one step to flatten the layers and leave it as a tiff then a second step to resize and convert to jpeg.


mkdir formated

for i in `ls -C1 *.TIF`
do
convert -verbose -flatten $i formated/$i
done

cd formated

for i in `ls -C1 *.TIF`
do
convert -verbose -resize 1280x960 $i $i.jpg
done
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: How do I convert tiff to jpeg and remove a layer

Post by anthony »

You could try to use -geometry.

This only resizes the LAST image in the current image sequence, which is hopefully the main image and not the thumbnail.

Hmm as the last image is the thumbnail, use +swap to swap the two image before using -geometry to resize the last one. You can +swap them back afterward if you want.

if you don't want the thumbnail +delete it instead.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
darkshadow

Re: How do I convert tiff to jpeg and remove a layer

Post by darkshadow »

Thanks, I just used the delete to get rid of the thumbnail.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: How do I convert tiff to jpeg and remove a layer

Post by anthony »

if you just wnat the first image and delete the second and later images (if they exist or not) use -delete 1--1

See IM Examples Basics, Delete for more detail
http://www.imagemagick.org/Usage/basics/#delete
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply