Page 1 of 1

Shell script creating offset

Posted: 2017-01-03T19:53:27-07:00
by cmeriaux
Hi,

I am having a weird issue and I would be keen to either get an explanation and a fix or an alternative method.

I have 2 directories from which I wish to combine pair of images with the same index. I have done that in the past without any issues until now.
This is typically the shell script I use

Code: Select all

#!bin/bash echo "$k items"
for i in $(seq -f "%05g" $1 $2 )
do
  File1=${3}${i}.jpg
  File2=${4}${i}.jpg
  FileOut=${5}${i}.png
  Command="convert +append "${File1}" "${File2}"  "${FileOut}
  echo $Command
  eval $Command
done
When I apply this to my current images, I systematically get an offset at the top left image.

What is weird is:
1) the images have the same height.
2) If I do not use the shell, but use the only command line to combine two images, the result is great.
3) I tried numerous way of combining the images including using montage. Combining two images not going though the shell script creates a great output while processing through the script fails and produces the offset.

Could someone provide a clue ?

Thanks Catherine

Re: Shell script creating offset

Posted: 2017-01-03T20:09:31-07:00
by snibgo
"+append" should come after the input images, not before.

Other than that, I can't see why the script should give a different result to a command-line.

What version IM are you using?

If the correct syntax doesn't cure the problem, please provide a pair of input images that show the problem, and the output. You can upload to somewhere like dropbox.com and paste URLs here.

Re: Shell script creating offset

Posted: 2017-01-04T01:48:10-07:00
by cmeriaux
I tried to shift the + append but the result is the same.

I tried on two machines one has ImageMagick-6.4.1 and the latest one.

The link to the images is:

https://www.dropbox.com/s/skqdmbx6biue1 ... t.jpg?dl=0
https://www.dropbox.com/s/omm5sv3kp3n6p ... e.jpg?dl=0

The usual output I get:
https://www.dropbox.com/s/zsue2krfsdk7j ... 4.png?dl=0

Thanks for having a look. Catherine

Re: Shell script creating offset

Posted: 2017-01-04T02:04:20-07:00
by snibgo
You won't get that output from those inputs with the command you showed.

Re: Shell script creating offset

Posted: 2017-01-04T02:16:44-07:00
by cmeriaux
As mentioned in my first message, if I run the command on two single figures, it indeed works perfectly. It only happens if I go through the shell script posted above for batch processing.

Re: Shell script creating offset

Posted: 2017-01-04T02:45:01-07:00
by snibgo
Your inputs are both 1920x1080 pixels, but your output is smaller, 1612x812 pixels. Those inputs didn't make that output with the command you showed.

I suspect the script isn't doing what you think it is doing.