[SOLVED] cropping sprites

Game development with Board Game Arena Studio
Post Reply
User avatar
apollo1001
Posts: 191
Joined: 21 July 2015, 10:41

[SOLVED] cropping sprites

Post by apollo1001 »

Hi All

I'm currently using a sprite of tiles which are a little large (essentially they have still got their bleed areas). I am able to use CSS to crop the outer 7px from around each tile without any issue, but I'm now wondering about using the Stock component to hold a selection of these tiles. To my knowledge the Stock component doesn't have any options to crop / offset / resize the images but simply carves up the sprite into the fixed size pieces.

So my question is: what is the easiest way to get my sprite file to work with the stock component? Currently the only way I can think of doing it is to crop each individual tile and rebuild the overall sprite. If anyone has used any clever sprite software or knows a way of setting this up with Stock then I'd welcome the advise!

For clarity all of my tile images are currently 7px too big in each direction and need cropping, not resizing.

Thanks
Apollo
Last edited by apollo1001 on 17 June 2018, 12:48, edited 1 time in total.
User avatar
Woodruff
Posts: 412
Joined: 08 March 2014, 00:53

Re: cropping sprites

Post by Woodruff »

Hi!

If you know the Python language, you can use the PIL library (Picture Image Library, Pillow in Python 3), to process your file programmatically:
https://pillow.readthedocs.io/en/5.1.x/
The idea is to loop on each card of your sprite, crop it and bundle them together again.
I think such utility exists in another language you'd like more.

Tcheby
User avatar
apollo1001
Posts: 191
Joined: 21 July 2015, 10:41

Re: cropping sprites

Post by apollo1001 »

Tchebychev wrote:process your file programmatically
Thank you Tcheby. Not sure why I hadn't thought of that in the first place! :lol:
User avatar
Woodruff
Posts: 412
Joined: 08 March 2014, 00:53

Re: [SOLVED] cropping sprites

Post by Woodruff »

My pleasure :)
Enjoy!
User avatar
Victoria_La
Posts: 620
Joined: 28 December 2015, 20:55

Re: [SOLVED] cropping sprites

Post by Victoria_La »

The imagemagic (command line image manipulation utils) have bunch of options of cropping/stitching/resizing/converting images.
I never had to do anything programmatically because it so reach. Do you have images before they got into sprite?
Post Reply

Return to “Developers”