mogrify Batch conversion of BMP > TIFF

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
ComputerCowboy
Posts: 5
Joined: 2011-03-08T15:34:37-07:00
Authentication code: 8675308

mogrify Batch conversion of BMP > TIFF

Post by ComputerCowboy »

I am trying to convert a folder full of BMP images to TIFF. They are individual frames from a movie.

they are all named by their frame number

Code: Select all

03/08/2011  05:38 PM         6,220,854 000001.bmp
03/08/2011  05:38 PM         6,220,854 000002.bmp
03/08/2011  05:38 PM         6,220,854 000003.bmp
03/08/2011  05:38 PM         6,220,854 000004.bmp
03/08/2011  05:38 PM         6,220,854 000005.bmp
03/08/2011  05:39 PM         6,220,854 000006.bmp
03/08/2011  05:39 PM         6,220,854 000007.bmp
03/08/2011  05:39 PM         6,220,854 000008.bmp
03/08/2011  05:39 PM         6,220,854 000009.bmp
03/08/2011  05:39 PM         6,220,854 000010.bmp
03/08/2011  05:39 PM         6,220,854 000011.bmp
03/08/2011  05:39 PM         6,220,854 000012.bmp
03/08/2011  05:39 PM         6,220,854 000013.bmp
03/08/2011  05:39 PM         6,220,854 000014.bmp
03/08/2011  05:39 PM         6,220,854 000015.bmp
03/08/2011  05:39 PM         6,220,854 000016.bmp
03/08/2011  05:39 PM         6,220,854 000017.bmp
03/08/2011  05:39 PM         6,220,854 000018.bmp
03/08/2011  05:39 PM         6,220,854 000019.bmp
03/08/2011  05:39 PM         6,220,854 000020.bmp
I have tried a number of commands but the one i really thought would work is this

Code: Select all

mogrify -format bmp *.tiff
which gives me this error

Code: Select all

Magick: unable to open image `*.tiff': Invalid argument @ error/blob.c/OpenBlob/
2587.
or this

Code: Select all

convert *.bmp *.jpg
which gives me the same error code

it doesn't seem to like the wildcards

what am I doing wrong? I saw examples just like this online and I've searched all around for the answer, it must be really easy!


Version: ImageMagick 6.6.8-0 2011-03-04 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP
Windows 7 Ultimate x64
HugoRune
Posts: 90
Joined: 2009-03-11T02:45:12-07:00
Authentication code: 8675309

Re: mogrify Batch conversion of BMP > TIFF

Post by HugoRune »

ComputerCowboy wrote:I am trying to convert a folder full of BMP images to TIFF. They are individual frames from a movie.
...
I have tried a number of commands but the one i really thought would work is this

Code: Select all

mogrify -format bmp *.tiff
which gives me this error

Code: Select all

Magick: unable to open image `*.tiff': Invalid argument @ error/blob.c/OpenBlob/
2587.
since there are no *.tiff files in the folder yet, mogrify cannot open them, that is what the error message means. You want to open all bmp files and store them in the format tiff.
This should work

Code: Select all

mogrify -format tiff *.bmp
ComputerCowboy wrote:

Code: Select all

convert *.bmp *.jpg
which gives me the same error code
convert cannot use wildcards in this way. It will output a single image per call.
you could however use a for loop http://www.imagemagick.org/Usage/windows/#for_loops

Code: Select all

FOR %a in (*.bmp) DO convert "%~a"  "%~na.tif"
ComputerCowboy
Posts: 5
Joined: 2011-03-08T15:34:37-07:00
Authentication code: 8675308

Re: mogrify Batch conversion of BMP > TIFF

Post by ComputerCowboy »

well the first command gives an error and the second command does work, thank you
below is the error for the first command

Code: Select all

F:\temp\out>mogrify -format tiff *.bmp
Magick: unable to open image `*.bmp': Invalid argument @ error/blob.c/OpenBlob/2
587.
HugoRune
Posts: 90
Joined: 2009-03-11T02:45:12-07:00
Authentication code: 8675309

Re: mogrify Batch conversion of BMP > TIFF

Post by HugoRune »

that is weird, it works for me. The error message indicates that mogrify cannot find any bmp files in F:\temp\out
Well, if the second command works...
ComputerCowboy
Posts: 5
Joined: 2011-03-08T15:34:37-07:00
Authentication code: 8675308

Re: mogrify Batch conversion of BMP > TIFF

Post by ComputerCowboy »

What if I want to encode them straight to jpeg 2000? how do I do that?
or are there options on the tiff output?

problem is that ffmpeg won't do tiff output for me, so i need to go to PNG to BMP
then i want to convert to TIFF so that I can use OpenDCP to conver to JPEG 2000 and then pack into a mxf file (digital cinema package)

when I try to conver the resulting TIFFs with OpenDCP i get this error

Code: Select all

C:\opendcp-0.17-bin-win32>opendcp_j2k.exe -i f:\temp\out -o g:\temp\j2c

OpenDCP J2K 0.17 (c) 2010-2011 Terrence Meiczinger, All Rights Reserved.
  Encoder: OpenJPEG
[ERROR] TIFF file creation. Bad color format. Only RGB & Grayscale has been impl
emented
[ERROR] Image f:\temp\out/000001.tiff is not DCI Compliant
I could skip that if I can make high quality jpeg 2000 from the PNG or BMP, otherwise I need to make the TIFF DCI compiant
HugoRune
Posts: 90
Joined: 2009-03-11T02:45:12-07:00
Authentication code: 8675309

Re: mogrify Batch conversion of BMP > TIFF

Post by HugoRune »

i have not used it so far, but imagemagick supports jpeg2000.
http://www.imagemagick.org/script/jp2.php

Code: Select all

FOR %a in (*.bmp) DO convert "%~a"  "%~na.jp2"
or

Code: Select all

mogrify -format jpeg2000 *.bmp
should do it
ComputerCowboy
Posts: 5
Joined: 2011-03-08T15:34:37-07:00
Authentication code: 8675308

Re: mogrify Batch conversion of BMP > TIFF

Post by ComputerCowboy »

that is cool, what about quality settings, I assume that just like regular jpeg it can be quality controlled high/low/medium compression
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: mogrify Batch conversion of BMP > TIFF

Post by fmw42 »

tmeiczin
Posts: 1
Joined: 2011-03-18T20:19:07-07:00
Authentication code: 8675308

Re: mogrify Batch conversion of BMP > TIFF

Post by tmeiczin »

ComputerCowboy wrote:What if I want to encode them straight to jpeg 2000? how do I do that?
or are there options on the tiff output?

problem is that ffmpeg won't do tiff output for me, so i need to go to PNG to BMP
then i want to convert to TIFF so that I can use OpenDCP to conver to JPEG 2000 and then pack into a mxf file (digital cinema package)

when I try to conver the resulting TIFFs with OpenDCP i get this error

Code: Select all

C:\opendcp-0.17-bin-win32>opendcp_j2k.exe -i f:\temp\out -o g:\temp\j2c

OpenDCP J2K 0.17 (c) 2010-2011 Terrence Meiczinger, All Rights Reserved.
  Encoder: OpenJPEG
[ERROR] TIFF file creation. Bad color format. Only RGB & Grayscale has been impl
emented
[ERROR] Image f:\temp\out/000001.tiff is not DCI Compliant
I could skip that if I can make high quality jpeg 2000 from the PNG or BMP, otherwise I need to make the TIFF DCI compiant
The jpeg2000 files from ImageMagick will not be DCI compliant. I'm not sure why this particular tiff doesn't convert without seeing it. What is your original source? If it is an mp4 or mpeg2, etc you should be able to create OpenDCP compatible tiff files with a command like:

Code: Select all

ffmpeg -y -i sample.mp4 -an -r 24 -pix_fmt rgb24 -vcodec tiff tif/%06d.tif
The -pix_fmt rgb24 is important to ensure you end up with RGB tiffs rather than YUV/YCrCb images.
ComputerCowboy
Posts: 5
Joined: 2011-03-08T15:34:37-07:00
Authentication code: 8675308

Re: mogrify Batch conversion of BMP > TIFF

Post by ComputerCowboy »

That looks like the ticket, thanks a lot.
As for sources, they are blu-rays (h.264), I am just learning about making DCP. I would like to make my own movies and put them into DCP.
Post Reply