123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|513|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Web Development -> PHP - Alpha'ing

Tue, 15 Dec 2020, 09:53
Jayenkai
Today's abandoned challenge : Editing and saving images with alpha transparency, using PHP's image commands. I can do ’’On or Off’’ but anything in-between seems to be impossible!

-=-=-
''Load, Next List!''
Tue, 15 Dec 2020, 09:53
cyangames
There are a couple of settings you can use to help preserve 8 bit transparency... I'll just find em, one mo

-=-=-
Web / Game Dev, occasionally finishes off coding games also!
Tue, 15 Dec 2020, 09:58
cyangames
I think if you set
alphablending to false and savealpha to true on the image you're copying to then you should get better results between images.

Assuming you're using GDLib here though, imagemagick is way more versatile.



-=-=-
Web / Game Dev, occasionally finishes off coding games also!
Tue, 15 Dec 2020, 10:51
Jayenkai
Ta, I'll give that a go, later.
I'm using PHP as-is on MacOS, so I'm not needing to reinstall buckets of stuff just to render an image!!
(Although, apparently future MacOseses won't include it.. ffs!)

-=-=-
''Load, Next List!''
Tue, 15 Dec 2020, 15:42
cyangames
Sounds like pretty terrible support there. Can you use a Virtual Machine and then run XAMPP as a workaround?

-=-=-
Web / Game Dev, occasionally finishes off coding games also!
Tue, 15 Dec 2020, 15:53
Jayenkai
PHP will still be installable, it just won't come preinstalled like it usually is.

-=-=-
''Load, Next List!''
Tue, 15 Dec 2020, 16:13
cyangames
Ahhhhh, gotcha
Thu, 17 Dec 2020, 06:46
Jayenkai
Ugh..
Got halfway through doing this, then realised I was doing it on the wrong blooming' sprite sheet..
*redo from start*

Thanks, though.. What I half-assed was at least working correctly

-=-=-
''Load, Next List!''
Thu, 17 Dec 2020, 07:48
Jayenkai
Sorted..
Thanks, Rychan!

Input =

Output =



-=-=-
''Load, Next List!''
Thu, 17 Dec 2020, 08:44

 
Jayenkai
Created : 17 December 2020
Edited : 17 December 2020

PHP Spritesheet Shuffler



A PHP script which.

1. Scans a folder for files named "filename_spritewidth_spriteheight_raw.png" or "filename_spritewidth_spriteheight_rawglow.png"

2. If padding is enabled, adds padding to the entire image, and sets the output to the next binary step. (eg 64,128,256,512,1024,2048)
(*I know that has a name, but right now I'm braindead!!)

3. Copies each individual sprite from your original sprite sheet onto the new sheet, leaving padding if required, and stripping out Magenta and Cyan from the output. (255,0,255 & 0,255,255)

4. Saves back out as a plain sprite sheet with transparencies where required, and again with IDs for each sprite on the sheet.

5. If the filename ended with rawglow instead of just raw, then it adds a blurry glow, and saves that version as G_filename.png (Note : This is slow!!)

6. If you've set a DupFolder, it places another copy of the final spritesheet in there, too.



Works fine in PHP7 with GDLib installed. Daren't test with PHP8, it'll probably implode!!

 
Thu, 17 Dec 2020, 09:22
cyangames
Glad I could help a lil bit