Page 1 of 2
convert not always ovewriting output
Posted: 2010-09-27T11:36:21-07:00
by cbonallo
We are using ImageMagic 6.5.6-10-Q8 in combination with WatchDir. The Command Line bat file contains this code:
"C:\Program Files\ImageMagick-6.5.6-Q8\convert.exe" "%WD_FILE%" -resample 72 / -filter lagrange -set option:filter:support 2.5 -resize 175X175 "\\harvard\webimages\%WD_FILE_B%.jpg"
Sometimes the desination file wil already exist. In most cases when this fires off because the original has changed (WatchDir job) the output file is overwritten with the new thumbnail.
However, just recently we had to redo all our thumbnails because we had some network outage that lead to the file server "Harvard" not being accessable while the ImageMagick bat file ran so the thumbnail was not created. It was just reported to me that some thumbnails do not match the original. I checked the time stamp on the file and it shows being modified at the right time by ImageMagick, but the underlying image did not get replaced with the new one?!
Is there a fix for this or has anyone else reported this?
Cory Bonallo
Retail Services Developer
Re: convert not always ovewriting output
Posted: 2010-09-27T22:25:48-07:00
by anthony
It sounds more like a file system problem where the file system updated the date, but not the data.
All that can be suggested is you somehow re-run the script for any thumbnail with a time stamp within the effected time period.
Re: convert not always ovewriting output
Posted: 2010-09-28T08:19:13-07:00
by cbonallo
We resized 80,000 images in 17 hour period. I have no idea which ones of those did not get updated... So this has never occured before? Are there any commands that can check the output image integrity?
Cory Bonallo
Re: convert not always ovewriting output
Posted: 2010-09-28T20:11:02-07:00
by anthony
basically have your script read the image back again!
But with file system caching, even that is no guarantee that the file is saved properly!
Re: convert not always ovewriting output
Posted: 2010-09-29T09:26:40-07:00
by cbonallo
What good would reading the image back do? If I checked the modify date it would be correct and I don't know the size because I resize it so what else can I compare that would be unique to a properly saved image verses one that is not?
Re: convert not always ovewriting output
Posted: 2010-09-29T21:39:04-07:00
by anthony
reading it bask will verify that the DATA is readable and not corrupt. that is the issue is it not!
Re: convert not always ovewriting output
Posted: 2010-09-30T08:13:43-07:00
by cbonallo
No. Let's see if I can make this clear. All the images are good images. However in some cases the new resized image is replacing an old image under the same name. On some of these particular images, the modified date is changed but it is still the old image, not the new one. It would read back ok.
Re: convert not always ovewriting output
Posted: 2010-09-30T16:24:53-07:00
by anthony
I see.
Hmm... Well IM itself does do anything special in writing the resulting image
It opens the filename, write to it and closes it.
If the filesystem fails to open the filename (for example file or directory is not writable), nothing gets written though an error should be produced. The date also should not be changed in such a case, unless a separate script command does something else separate to IM.
I myself have had cases where IM errored and did not generate a thumbnail, but the script then 'fixed' the date of the old thumbnail, makign it wrong. But it was not IM's fault.
I have no idea how you can fix your erroneous thumbnails, other than by re-doing them all.
As for preventing future problems, that I suppose depends on what actually caused the problem in the first place.
Re: convert not always ovewriting output
Posted: 2010-09-30T16:35:13-07:00
by fmw42
I don't know if this will help or not, but have you tried adding -regard-warnings to your command line to make IM provide a proper exit status so that you can see if IM is at fault. see
http://www.imagemagick.org/Usage/basics/#controls
Re: convert not always ovewriting output
Posted: 2010-09-30T16:45:25-07:00
by cbonallo
Well none of the images are write protected. IM is not throwing any errors. So my guess is that Im is opening the filename, which changes the dates and is not getting a chance to write to the file. Would IM not produce an error if it was able to open the file and not able to close it?
Re: convert not always ovewriting output
Posted: 2010-09-30T16:51:01-07:00
by cbonallo
Thanks for the tip on -regards-warnings. I'll give that a shot and see if I can get more info. Do you know where the warnings are stored?
Re: convert not always ovewriting output
Posted: 2010-09-30T17:39:19-07:00
by fmw42
cbonallo wrote:Thanks for the tip on -regards-warnings. I'll give that a shot and see if I can get more info. Do you know where the warnings are stored?
Standard error I believe. But in command line any errors show at the terminal. Anthony can give you more details.
Re: convert not always ovewriting output
Posted: 2010-09-30T18:01:01-07:00
by anthony
Hmmm if the data in the file is unchanged then the 'date' tag in the thumbnail (if it exists) will also be unchanged. However that tag would not be 'close' to the date of the file!
So (for generated thumbnails only) if the thumbnail format has a internal date you can compare that to the file date to see how 'off' it is, or if the thumbnail data itself is 'too old'.
Of course this only works if the image file format used for thumbnails contains a modified 'date'.
(PNG files I know do! Not certain about GIF)
Re: convert not always ovewriting output
Posted: 2010-10-01T08:50:06-07:00
by cbonallo
These are JPG's. Any clue as to the proper commands to check the JPG header and file modify date? Sadly I am more developer than photographer so I don't know much about image files...
Re: convert not always ovewriting output
Posted: 2010-10-01T10:24:11-07:00
by fmw42