Wednesday, January 25, 2017

Exporting square tiles from a stripe - in Inkscape or Gimp


I am using Inkscape and Gimp to create assets for a word game and am looking for an advice from more experienced users of these great tools.


In Inkscape I have created a stripe with 26 letters and their values:


Inkscape stripe


The stripe is comfortable to edit - I have enabled grid snapping there and also I can always revisit the SVG file and change font sizes or letter values.


Then I have exported the SVG file as a whole page to PNG files in different resolutions:



Inkscape bitmap


Unfortunately, loading a 6240 x 240 pixels PNG file does not work with Android (because of OpenGL width limitation for textures - 2048 pixels on many devices).


So I have to split the SVG file or the resulting PNG files in square images of 240 x 240 pixels for each letter (Android could process them without problems).


My question is if anyone knows a good way to perform such a split in Inkscape (that would be best) or in Gimp?


In Export Bitmap dialog of Inkscape I see a batch-related checkbox... Could it be used for my purposes?



Answer



Yes, you can do it in Gimp, but in my opinion is simpler with ImageMagick (see also here).


You need to put a lot of guidelines where you need to cut:


guidelines


And then simply apply the Guillotine transform:



guillotine


After this, you have the original image split in a lot of imagettes:


a lot of images


And you have to save - pardon, export - each of them with a proper name.


Ok, maybe you can use a script for the guidelines and apply the slice plugin (which saves the pictures in a folder) to make it faster...


In Inkscape you can choose the area to export, and you can simply calculate the proper coordinates and save each image:


save area in Inkscape


See also here for Inkscape.


Trust me, I love Gimp and Inkscape, but a more proper tool for this kind of operation is Imagemagick ;-).


No comments:

Post a Comment

technique - How credible is wikipedia?

I understand that this question relates more to wikipedia than it does writing but... If I was going to use wikipedia for a source for a res...