Image "matrix", making one image using several files

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?".
Locked
User avatar
Suru
Posts: 2
Joined: 2017-03-29T02:12:27-07:00
Authentication code: 1151

Image "matrix", making one image using several files

Post by Suru »

I try make "modular" image. This is not only this case, several times check quite similar problem, and looks Imagemagick solve this problem. I use windows, but it is not problem :).

Case, image is "modular". As you see this photo:

Image

Photo is "modular". First, I have frame, in this photo I have three frame. It is also possible use 1 frame, 2 frame, 3 frame, 4 frame etc. This frame contain 3 hole- it is "three module frame". It is also one hole frame or two hole frame. (In real life this frames are 140 mm width).

Every hole I can put any module- this photo show quite large set of modules.

How I do this now? Now I use Corel Draw (also this is possible with eg. Inkscape or Illustrator or even powerpoint..). I have all this modules just 1:1 size in Corel Draw. Just this photo is processed with corel draw: select frame -> make 2 copy X140 mm ok. Then I drag all modules to holes "snap to object" (in every hole I have helping-tool-circle). Then, simply, export-jpg or export-png or, export-pdf.

All this "modules" and "frames" I have as png-files, containing also transparency. Files are in same scale, so, I can open it any program I want and then simply build this type images. So: Not need any resize.

Question is: Maybe this work can be automatize?

1, how I can make script "read frame3.png", "read module-speaker-4-.png", "read module-button-8.png" etc etc, and snap it to right position? (Plz notify, all png-file-modules are in scale, not need resize.). Then automatically export file as png or jpg.

2, step 2 is build this using command file. It is:
- Line 1: frame3 frame3 frame3
- Line 2: frame1 frame1 frame1
- And then module list...
So, script read module list using text file.
God Bless Engineers. (BSc.)

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Image "matrix", making one image using several files

Post by snibgo »

So, you have PNG files, representing frames and modules. You want to assemble them.

The ImageMagick command could be something like this:

Code: Select all

convert ^
( frame1.png ^
  module1.png ^
  -geometry +20+100 -composite ^
  module2.png ^
  -geometry +20+150 -composite ^
) ^
( frame2.png ^
  module3.png ^
  -geometry +20+100 -composite ^
  module4.png ^
  -geometry +20+150 -composite ^
) ^
( frame3.png ^
  module9.png ^
  -geometry +20+100 -composite ^
) ^
+append ^
out.png
Each "-geometry +X+Y" gives the X,Y coordinate of the module within the frame.

If you want that in the simpler form of jusr frames and modules, then you also need a script to convert that into an ImageMagick command.
snibgo's IM pages: im.snibgo.com

Locked