Page 1 of 1

Multiply Image by 6 and export

Posted: 2019-07-26T06:11:04-07:00
by berndh70
Hello Imagemagick professionals,

I need to convert images of winebottles. I have a jpg image of the bottles, all same height but different width (according to the bottlesize).

The image of the bottle has to be resized, multiplied by 6 (or 3) and pasted in a new image of a rectangular size (e.g. 1000 x 1000). So the original image contains one bottle, the resulting image contains 6 (or 3) similar bottles of the original.

I need a script, that converts every image in a specific folder with this procedure.

Can somebody provide help with that? Offers for that would be very appreciated. /* To the admins - I am willing to pay for it */

Thanks in advance and kind regards

Bernd

Re: Multiply Image by 6 and export

Posted: 2019-07-26T06:53:39-07:00
by snibgo
What version of IM, on what platform?

You need to resize, but to what size? The same size for all images, or is there some rule for the new size?

Perhaps sample input and output images would help.

Re: Multiply Image by 6 and export

Posted: 2019-07-26T09:12:24-07:00
by berndh70
Hi snibgo,

thanks for the reply. I installed the program today via Homebrew on a Mac, so I guess it's the current version, but I am not familiar with the software at all. I am just a "normal" user with little command line knowledge.

The pictures all have the same height of 800px. The width is different depending on the bottle.

Example for 6 bottles:
Original file wine1:
Result file wine1:

Original file wine2:
Result file wine2:

Example for 3 bottles:
Result wine2:

A process should look something like this:

numberOfBottles=6
canvasSize=1000

1. open the original file
2. scale it to [canvasSize/numberOfBottles] width (=166px)
3. generate a canvas of [canvasSizexcanvasSize] (=1000x1000px)
4. paste [numberOfBottles] in one line on the canvas
5. save resulting picture under filename [numberOfBottles]+"x"+originalFilname.jpg in a designated folder

This process should apply to all pictures in a specific folder. A script for another number of bottles should do the same accordingly. I basically need this script for 3 and 6 bottles.

Hope I could clarify a little. Please don't hesitate to ask any questions or if everything is clear send me an offer. I would prefer to pay via Paypal.

Thanks in advance
Bernd

Re: Multiply Image by 6 and export

Posted: 2019-07-26T09:56:25-07:00
by snibgo
berndh70 wrote:... via Homebrew on a Mac
I'll leave this for Fred or anyone else.

Re: Multiply Image by 6 and export

Posted: 2019-07-26T10:01:57-07:00
by fmw42
What version of ImageMagick did you install?

On IM6 on command line type

Code: Select all

convert -version
On IM7 type

Code: Select all

magick -version

Re: Multiply Image by 6 and export

Posted: 2019-07-26T10:14:26-07:00
by fmw42
How much space should be put between the bottles? Can you quantify that in percent of width of the image or pixels? Or should it just use whatever space you provide.

The simple command would be something like

Code: Select all

number=6
dups=$((number-1))
file="image.jpg"
convert "$file" -duplicate $dups +append -resize 1000x1000 -background white -gravity center -extent 1000x1000 "${output_directory}/${number}x${file}"
I have to go out for a while but I will work on this later today. I presume you want a shell script or do you need an AppleScript?

Re: Multiply Image by 6 and export

Posted: 2019-07-26T11:29:55-07:00
by berndh70
Version: ImageMagick 7.0.8-56 Q16 x86_64 2019-07-24 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP(3.1)
Delegates (built-in): bzlib freetype heic jng jp2 jpeg lcms ltdl lzma openexr png tiff webp xml zlib

And I think a shell script is fine. You just have to explain me the proper excecution ;-)

And thanks for helping!

Re: Multiply Image by 6 and export

Posted: 2019-07-26T11:56:54-07:00
by fmw42
Please send me private mail on this system with your actual email address so that I may contact you directly and send the script. No charge, since I think it is very simple.

Re: Multiply Image by 6 and export

Posted: 2019-07-26T12:04:24-07:00
by fmw42
Are all the input images JPG? If not, what other formats does the script have to process?

Re: Multiply Image by 6 and export

Posted: 2019-07-26T14:05:38-07:00
by berndh70
Sent you a message on the board.

Re: Multiply Image by 6 and export

Posted: 2019-07-26T16:01:49-07:00
by fmw42
I receive no new messages from you since this morning. Are you sure you sent it?