Image Textmerge

Magick.NET is an object-oriented C# interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick.NET
Post Reply
Morv
Posts: 3
Joined: 2017-01-29T04:40:25-07:00
Authentication code: 1151

Image Textmerge

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

Re: Image Textmerge

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

Re: Image Textmerge

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

Re: Image Textmerge

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

Re: Image Textmerge

Post 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
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Image Textmerge

Post by dlemstra »

Do you have an example of what kind of areas you want to put your text in?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
Post Reply