Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ofn-tiles : example image
#1
How to extract the tiles (the fonts) of this specific image using ofn-tiles ?
It are not squares

And if it's not possible using ofn-tiles , then I can only do it using below?

- making guides between the tiles
- python_fu_ofn_guillotine_layer
- python_fu_ofn_export_layers

Or is there another more easy way with script/plugin that is available somewhere?

Can I do this with gmic?


Attached Files Thumbnail(s)
   
Reply
#2
(03-03-2024, 07:56 PM)gimpygirl Wrote: How to extract the tiles (the fonts) of this specific image using ofn-tiles ?
It are not squares

And if it's not possible using ofn-tiles , then I can only do it using below?

- making guides between the tiles
- python_fu_ofn_guillotine_layer
- python_fu_ofn_export_layers

Or is there another more easy way with script/plugin that is available somewhere?

You measure the characters, from the top corner of one to the top corner of the one below to the right: 150x416

   

Your crop the image from the top left corner of the first character, making sure that the result is a multiple of the tile size

   

You export

   

Result:

   

As you have probably noticed, the Heart is a bit truncated because your character aren't as regularly spaced as the look. The left edges are respectively at: 0, 151, 301, 450, 600, 750, 900, 1049, 1199, 1349, 1499, 1648, 1798, 1948, 2098, 2247.


 
Reply
#3
If you want to get rid of the spacing, an alternative is to use ofn-layer-tiles to do the cut:

   

Then you crop the resulting image to remove the spacing on all layers in one shot:

   

And then you export with ofn-export-layers
Reply
#4
(03-03-2024, 08:54 PM)Ofnuts Wrote:
As you have probably noticed, the Heart is a bit truncated because your character aren't as regularly spaced as the look. The left edges are respectively at: 0, 151, 301, 450, 600, 750, 900, 1049, 1199, 1349, 1499, 1648, 1798, 1948, 2098, 2247.

Sorry i dont speak english. What do you mean by "your character aren't as regularly spaced as the look".

It's a big complicated to write a plugin for (for me). I want automatic process since i'm doing many of these images for font making.

I just found g'mic can do it with "extract objects"! They are extracted perfectly.

Do you know if I can make a plugin that calls g'mic and how?

Or how to batch process g'mic on a whole folder of images like the example?

So I want:

1. "extract objects" but the dot must be in the blue area (see image)
2. export all layers using your plugin

is this possible to combine in a plugin (1 + 2)?

I especially need code for 1 (2 I can do now)

If I use ofn-export-layers on the layers g'mic made (see previous example), they are exported by starting from the LAST layer Sad

See screenshot: it starts with number 32. You know why?
see next screenshot: the result of ofn-export-layers (with numUp0). I need the reverse order Sad


Can you add an option to ofn-export-layers to export the layers reverse order so the numUp0 is starting from 0 and corresponds to the first symbol in the image from left to right?
Maybe checkbox "reverse layer order"?


Attached Files Thumbnail(s)
           
Reply
#5
(03-04-2024, 01:16 AM)gimpygirl Wrote: Sorry i dont speak english. What do you mean by "your character aren't as regularly spaced as the look".

Besides the typo "the/they". You would expect the distance between consecutive characters to be constant, but here it varies between 149 and 151 pixels. And IMHO this is due to some scaling that happened earlier in the workflow and that should have been avoided.

Quote:It's a big complicated to write a plugin for (for me). I want automatic process since i'm doing many of these images for font making.

I just found g'mic can do it with "extract objects"! They are extracted perfectly.

Do you know if I can make a plugin that calls g'mic and how?

Or how to batch process g'mic on a whole folder of images like the example?

So I want:

1. "extract objects" but the dot must be in the blue area (see image)
2. export all layers using your plugin

is this possible to combine in a plugin (1 + 2)?

I especially need code for 1 (2 I can do now)

I have no experience with GMIC scripting. Although it seems to solve your problem, you may end up with characters of varying widths.

Quote:If I use ofn-export-layers on the layers g'mic made (see previous example), they are exported by starting from the LAST layer Sad

See screenshot: it starts with number 32. You know why?
see next screenshot: the result of ofn-export-layers (with numUp0). I need the reverse order Sad


Can you add an option to ofn-export-layers to export the layers reverse order so the numUp0 is starting from 0 and corresponds to the first symbol in the image from left to right?
Maybe checkbox "reverse layer order"?

Did you ever wonder why the variable is called numUp? And then wonder if there could possibly be something called numDown?
Reply
#6
(03-04-2024, 01:16 AM)gimpygirl Wrote: I just found g'mic can do it with "extract objects"! They are extracted perfectly.

Do you know if I can make a plugin that calls g'mic and how?  

Just some hints, nothing else. I do not really see that a batch operation will work.

When you find a gmic command that works, there is a button top-right that copies the command to the clip-board.

   

That gives
Code:
fx_extract_objects 7.3,17.7,20,50,0.3,0,0,1

and that goes into your script as

Code:
pdb.plug_in_gmic_qt (image, drawable, 1, 0,   "fx_extract_objects 7.3,17.7,20,50,0.3,0,0,1"),

and an example plugin attached. Unzip it. Registers in the Tools menu.

For exporting images with numbering and the layers are in the wrong 'direction' Then Layer -> Stack -> Reverse Layer Order does what it says.

Demo of that. https://i.imgur.com/49QqHmH.mp4


Attached Files
.zip   for_gmic.zip (Size: 463 bytes / Downloads: 280)
Reply


Forum Jump: