sequential numbering works/doesn't work - will pay for help

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
goyop
Posts: 12
Joined: 2009-08-11T15:11:50-07:00
Authentication code: 8675309

sequential numbering works/doesn't work - will pay for help

Post by goyop »

Following is the code which is in a bat file on Windows

imconvert PA1_*.jpg +repage -scene 001 PA1_%%03d.jpg
imconvert PA1_*.jpg null: D:\AxisFTPLocal\Preset1\MASK_1.png -layers Composite D:\AxisFTPLocal\Preset1\Mask\PA1_.jpg
cd D:\AxisFTPLocal\Preset1\Mask
FORFILES -pD:\AxisFTPLocal\Preset1\Mask -m*.avi -c"CMD /C DEL @FILE"
imconvert PA1_*.jpg +repage -scene 001 PA1_%%03d.jpg

1) there are 40 jpgs
2) the first line works fine
3) the second line is a mask that works fine and creates 40 new jpgs
4) third line change directory
5) fourth line purges old AVI
6) fifth line is the exact same command as the first line only being run in a different directory. When this line runs it creates exactly double the amount of original files, 80. Upon inspection it runs through the source jpgs twice from start to finish and cranks out 80. This is problematic since it doubles the size of the AVI and is the same clip twice.

Any ideas?

Thanks,

Greg
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: sequential numbering works/doesn't work - will pay for help

Post by anthony »

I do not recommend reading and writing repeatly to JPG and every time you write a JPEg you 'loose' some image information ,making the image steadily worse.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: sequential numbering works/doesn't work - will pay for help

Post by fmw42 »

I am not sure I understand why you are repeating the same operation in D as you did in C directories? Are they not already numbered as you need them? Can you not just number the results of the composite to be the same as the input numbering? The duplication probably occurs because you are not just renaming, but creating new images. One possible solution would be to write the D images with your last command to third directory that is empty.

JPG is not good to use for intermediate processing as each time IM reads it, it has to rewrite it and so you lose quality due the jpg compression. IM will not just rename without reading.

JPG does not support virtual canvas and so I think perhaps the +repage is useless.
goyop
Posts: 12
Joined: 2009-08-11T15:11:50-07:00
Authentication code: 8675309

Re: sequential numbering works/doesn't work - will pay for help

Post by goyop »

Thanks for the replies.
OK, one issue at a time.

Output of twice the number of files:
In digging further, I was mistaken yesterday (end of day fog) and the operation that is outputting double the jpg's was a stupid mistake. We have a version of this script running on a different video server and we dump the jpgs into the directory and run the sequential numbering and dump them into the same directory. From there all we do is compile them into an AVI and call the source files "File_%%03d.jpg". This works fine. But in this new server when I tried to script the composite, it wouldn't take that file name convention so I had to use "File_*.jpg". This then called the original and the renumbered jpg's thus doubling it.

So I have added a directory to manage this and we are OK with this part.

Repeating the sequential numbering:
First of all, I agree. I am just not sure how to force the file naming on the output of the composite process. The files are definitely numbered but the AVI conversion will not accept the format so I have to get it back to "File_001.jpg" format. (Figured it out. I just used the same naming command that we already used "File_%%03d.jpg" duh.)

Repeated processing of JPG's
Thank you Anthony for the tip. I will definitely keep an eye on the quality. We are forced to start with JPG's because that is what the camera puts out. So far the quality is OK because the final output will be a 400 x 300 window on a browser. However, if we could solve item #2 of this list that would be one less iteration, better quality, and less processing time.

Thanks
Post Reply