Shell script creating offset

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
cmeriaux
Posts: 3
Joined: 2017-01-03T19:40:07-07:00
Authentication code: 1151

Shell script creating offset

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Shell script creating offset

Post 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.
snibgo's IM pages: im.snibgo.com
cmeriaux
Posts: 3
Joined: 2017-01-03T19:40:07-07:00
Authentication code: 1151

Re: Shell script creating offset

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Shell script creating offset

Post by snibgo »

You won't get that output from those inputs with the command you showed.
snibgo's IM pages: im.snibgo.com
cmeriaux
Posts: 3
Joined: 2017-01-03T19:40:07-07:00
Authentication code: 1151

Re: Shell script creating offset

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Shell script creating offset

Post 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.
snibgo's IM pages: im.snibgo.com
Post Reply