Page 1 of 1

Image Textmerge

Posted: 2017-01-29T05:22:07-07:00
by Morv
I have some simple questions about magicknet's functionallity and if it provides the neccessary functions for my behaviour.

I want to merge .xcf-Files with an number of layers which each represents an area for a specific text. Each layer/area has a specific name (the Name of the layer in Gimp) which provides information about the Text which should be written into. E.g "Title", "Subtitle", "Company" and so on.

Now I have a number of different xcf-files with the same layer-names and I want to merge the Text automatically. Preferably i would do this via magickscript - One ore more scripts for each xcf which i call via Code.

So my questions are:
- is it possible to get the layers by Name ? E.g Like myXcf["titleLayer"] ...
- in Gimp, the layers have yellow borders which define the area the Text should be written. Is ist possible to get the Position and size of these areas?
- does magicknet provide functions for adding textblocks with specific font and fontsize?
- in some cases i need to prefer the transparancy.

Best regards
Morv

Re: Image Textmerge

Posted: 2017-01-29T07:46:40-07:00
by snibgo
Morv wrote:- is it possible to get the layers by Name ? E.g Like myXcf["titleLayer"] ...
No. IM can't read Gimp's layer names. But a batch script can tell Gimp to write the layer nmes to a text file, or write a tiff with layer names that IM cn read. See my "Gimp and IM" page.
Morv wrote:- in Gimp, the layers have yellow borders which define the area the Text should be written. Is ist possible to get the Position and size of these areas
Yes. If you have no other yellow on your image, the task is trivial: trimming non-yellow gives the location.
Morv wrote:- does magicknet provide functions for adding textblocks with specific font and fontsize?
Yes, you can add text with font and font size.

Re: Image Textmerge

Posted: 2017-01-30T06:11:40-07:00
by Morv
Ah, thank you!

I think you missunderstood the yellow borders, they are only visible in Gimp, when i select one of the layers. So, I cant her the Position and size via trimming yellow. So you think there is any other way for achieving this?

Had a look at your Page yesterday, very nice Work !

Best regards

Re: Image Textmerge

Posted: 2017-01-30T06:24:00-07:00
by snibgo
Morv wrote:So you think there is any other way for achieving this?
If there is, it would come from Gimp, not ImageMagick.

Re: Image Textmerge

Posted: 2017-02-11T09:57:47-07:00
by Morv
We've changed the Concept and now will use MagickScript for merging the Texts into/onto the images. We will define some xml-Files with some kind of Placeholders for the Text which we will replace with different Content.

Current test.xml looks like this.

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<msl xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MagickScript.xsd">
  <read>
    <draw >
      <font family="DINRoundOT-Medium" />
      <fontPointSize pointSize="140"/>
      <fillColor color="#FFF"/>
      <text value="Foo" x="100" y="350"/>
    </draw>
    <draw >
      <font family="DINRoundOT-Medium" />
      <fontPointSize pointSize="140"/>
      <fillColor color="#FFF"/>
      <text value="Baa" x="150" y="650"/>
    </draw>
  </read>
</msl>
I have Problems placing the Text into predefined Areas (in the xml) so that I can Center them content-independent. For example we want to use the same xml for different Languages, and the Text should be centered in predefined Areas regardless of the textlength.

Thanks for any Help

Re: Image Textmerge

Posted: 2017-02-12T15:06:13-07:00
by dlemstra
Do you have an example of what kind of areas you want to put your text in?