Author Topic: Touhou 14: Editing certain image types?  (Read 6641 times)

Ciel

  • Green-Eyed Jealousy
Touhou 14: Editing certain image types?
« on: June 01, 2013, 04:36:41 PM »
Hi guys 8D Just wondering if anyone knows how to edit and save certain image types?

Currently the image file which I want to edit is this one:


While it looks great and all, but when you open it in Photoshop or Sai and save it, it ends up like...



(Yeah I know, it's ugly. D8<)

You guys could try it out yourselves. Thank you very much in advance for the interest!

Just some weirdo, move along!

EthanSilver

  • Lunatic Programmer
  • Got squid, will travel.
    • Ethan Silver's Junkpile - Hacks and translation patches
Re: Touhou 14: Editing certain image types?
« Reply #1 on: June 01, 2013, 04:53:16 PM »
Whatever you're doing, you're not saving the image's alpha channel properly. In fact it seems like you're saving the image with color keying (ie, making one specific color transparent) as a SMALL band of 0% opacity pixels surrounds most letters in the image you posted.

Unfortunately my image editing software is a little dated (I'd rather work with something I'm familiar with than brag about having all the new bells and whistles and not having a use for them) so I wouldn't be able to give you step by step instructions on saving the image properly in your software of choice. If you're given image format-related options when saving your image, look into them and make sure you're saving the alpha channel as-is (again, I'm pretty convinced from the 1px transparent band around letters that you're using color-keying/single-color-transparency/whatever your software calls it to handle the alpha channel...).


Latest works
The Strongest

Ciel

  • Green-Eyed Jealousy
Re: Touhou 14: Editing certain image types?
« Reply #2 on: June 01, 2013, 05:28:14 PM »
Whatever you're doing, you're not saving the image's alpha channel properly. In fact it seems like you're saving the image with color keying (ie, making one specific color transparent) as a SMALL band of 0% opacity pixels surrounds most letters in the image you posted.

Unfortunately my image editing software is a little dated (I'd rather work with something I'm familiar with than brag about having all the new bells and whistles and not having a use for them) so I wouldn't be able to give you step by step instructions on saving the image properly in your software of choice. If you're given image format-related options when saving your image, look into them and make sure you're saving the alpha channel as-is (again, I'm pretty convinced from the 1px transparent band around letters that you're using color-keying/single-color-transparency/whatever your software calls it to handle the alpha channel...).
Thanks for the quick reply! o/

Ahh, the thing is, when I opened, it already showed the entire black background. I'm not using all the latest hoo hah either. ;~; Adobe Photoshop CS2 and Sai. I'm aware with the alpha features but I'm not very familiar with them.

Just some weirdo, move along!

EthanSilver

  • Lunatic Programmer
  • Got squid, will travel.
    • Ethan Silver's Junkpile - Hacks and translation patches
Re: Touhou 14: Editing certain image types?
« Reply #3 on: June 01, 2013, 07:48:32 PM »
I'm aware with the alpha features but I'm not very familiar with them.
The alpha component of a pixel is its opacity - it's like the whole RGB set of components, only this is a fourth one. Since your monitor can't display translucent pixels image-editing software often relies on displaying a background color/pattern and blending the image with it based on the opacity of its pixels. In PSP7, for instance, I get something kinda like this...



If I get rid of the alpha channel through whichever means, instead of being gradually more translucent the pixels come out as various "solid" shades of grey. For instance, the lowest pixel is actually solid white rather than 100% translucent over a white background - there's no blending at work here.



There are ways to lose the alpha channel, like copy-pasting the image or merging layers, but that changes from program to program. Try opening and saving the images without modifying them - if you still end up without an alpha channel then you'll want to look into what settings your program offers. In PSP7, for instance, I have this:


Note the single-color transparency option: that would give the kind of results you're getting right now - again, there IS some alpha channel being used in your images but it's only affecting a single color, leaving a thin band of transparent pixels around the text.

If you can open and save the image just fine, then you're doing something to lose the alpha channel while editing the image. Be wary of copy-pasting the entire image into a new file and things like that, though a bit of trial and error should turn up which operation you performed caused you to lose the alpha channel.

Hopefully that helps!


Latest works
The Strongest

Drake

  • *
Re: Touhou 14: Editing certain image types?
« Reply #4 on: June 01, 2013, 11:49:43 PM »
Doesn't really help since that isn't the problem at all.

The "problem" is that the images are 8-bit PNG with alpha channel. How the image format works is that there's a color map with 256 colors used in the image, and the index of each of these colors is what is stored per pixel. This way instead of using all 24 bits to store the RGB color per pixel, it only needs to use 8. In addition, each indexed color can carry an alpha value, so if all of the color and alpha combos fit in the 256 colors then it's a good space-saver.
The real problem is that PS and some other graphics editors are dumb and don't know how to properly open them and screw them all up because they don't read the alpha value per indexed color. You get some transparency because with indexed colors there's one dummy color used for 100% transparency, so it'll read that because it's the color and not the alpha value, but not anything else. Not reading the alpha value is why there's the black background where it should be transparent, why there are jaggies, and why the blue outline is flat rather than segueing to transparent.

As far as I know you can't just tinker with things in PS to get it to work properly. But you can use pngout to force the image into the usual 24-bit RGB. I'm not sure about the GUI tool, but with the command line tool you run it with pngout -c6 -force file.png.


But now you have to tell me how you got rank00.png out of title.anm.

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

EthanSilver

  • Lunatic Programmer
  • Got squid, will travel.
    • Ethan Silver's Junkpile - Hacks and translation patches
Re: Touhou 14: Editing certain image types?
« Reply #5 on: June 02, 2013, 02:42:27 AM »
The "problem" is that the images are 8-bit PNG with alpha channel.
The images I've extracted from my copy of the trial come out as 32bpp images. The image the OP uploaded is also 32bpp. Is converting a 32bpp image to 8bpp internally a quirk of PS? If so, and assuming the OP can track down a copy, I'd recommand Paintshop Pro 7. It may be old but it's never done any kind of funny business with my images' format. ;)
(Right-click save-as and open in your favorite alpha-channel-capable image editor.)

But now you have to tell me how you got rank00.png out of title.anm.
thtk5 can work with the trial's files. It stutters a bit on the .dat itself but at first glance, surprisingly, it doesn't seem to cause problems. Didn't really toy around with the game past the title screen though.

Off the top of my head, "thanm x title.anm" can extract title.anm's files just fine. :)


Latest works
The Strongest

Ciel

  • Green-Eyed Jealousy
Re: Touhou 14: Editing certain image types?
« Reply #6 on: June 02, 2013, 03:27:51 AM »
The alpha component of a pixel is its opacity - it's like the whole RGB set of components, only this is a fourth one. Since your monitor can't display translucent pixels image-editing software often relies on displaying a background color/pattern and blending the image with it based on the opacity of its pixels. In PSP7, for instance, I get something kinda like this...



If I get rid of the alpha channel through whichever means, instead of being gradually more translucent the pixels come out as various "solid" shades of grey. For instance, the lowest pixel is actually solid white rather than 100% translucent over a white background - there's no blending at work here.



There are ways to lose the alpha channel, like copy-pasting the image or merging layers, but that changes from program to program. Try opening and saving the images without modifying them - if you still end up without an alpha channel then you'll want to look into what settings your program offers. In PSP7, for instance, I have this:


Note the single-color transparency option: that would give the kind of results you're getting right now - again, there IS some alpha channel being used in your images but it's only affecting a single color, leaving a thin band of transparent pixels around the text.

If you can open and save the image just fine, then you're doing something to lose the alpha channel while editing the image. Be wary of copy-pasting the entire image into a new file and things like that, though a bit of trial and error should turn up which operation you performed caused you to lose the alpha channel.

Hopefully that helps!
Oooh, you really do learn something new everyday. AHAHA I HAVE BEEN USING THESE THINGS AND I HAVE NO IDEA WHAT THEY ARE;; I always refer to them as just "transparency". I didn't get that dialog box even with Photoshop, and I downloaded Paint Shop Pro 7 too, but nothing.

Doesn't really help since that isn't the problem at all.

The "problem" is that the images are 8-bit PNG with alpha channel. How the image format works is that there's a color map with 256 colors used in the image, and the index of each of these colors is what is stored per pixel. This way instead of using all 24 bits to store the RGB color per pixel, it only needs to use 8. In addition, each indexed color can carry an alpha value, so if all of the color and alpha combos fit in the 256 colors then it's a good space-saver.
The real problem is that PS and some other graphics editors are dumb and don't know how to properly open them and screw them all up because they don't read the alpha value per indexed color. You get some transparency because with indexed colors there's one dummy color used for 100% transparency, so it'll read that because it's the color and not the alpha value, but not anything else. Not reading the alpha value is why there's the black background where it should be transparent, why there are jaggies, and why the blue outline is flat rather than segueing to transparent.

As far as I know you can't just tinker with things in PS to get it to work properly. But you can use pngout to force the image into the usual 24-bit RGB. I'm not sure about the GUI tool, but with the command line tool you run it with pngout -c6 -force file.png.


But now you have to tell me how you got rank00.png out of title.anm.
HI DRAKE

Ohh, the pngout does help but... what about converting it back? Since I think the image format is required to be the same as the original in the end? D:

As for the image, the wiki has it!: http://thpatch.net/wiki/File:Th14-rank00tr.png

(Right-click save-as and open in your favorite alpha-channel-capable image editor.)
OH MY GOODNESS, That IMAGE LOL.

THE PRODUCT IS NICE YES INDEED but when you save it and open it, it doesn't have the same format as the original image. D8;;

Just some weirdo, move along!

Drake

  • *
Re: Touhou 14: Editing certain image types?
« Reply #7 on: June 02, 2013, 03:51:28 AM »
I'd be able to answer that if I could get this stuff working properly myself.

thdat works fine (as far as I can see comparing the listed entries) extracting the files, but thanm fails repeatedly on many of the anm files despite being very-likely a good extraction.

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

EthanSilver

  • Lunatic Programmer
  • Got squid, will travel.
    • Ethan Silver's Junkpile - Hacks and translation patches
Re: Touhou 14: Editing certain image types?
« Reply #8 on: June 02, 2013, 04:07:22 AM »
Slightly off-topic but...

thanm fails repeatedly on many of the anm files despite being very-likely a good extraction.
I've tried a couple of files (ex, here's Kagerou) and haven't seen any problems so far. Not sure how old/recent my version is (ie, whether a minor update has been made in the latest release that changes something that just happened to make DDC's files work with it or something) but it apparently does work, so I figured I may as well share the wealth. :)

I should also note I'm mostly just plucking the anm files out of the translation patch's "dat" folder. It could just be doing a far better job of extracting the .dat's contents than thtk currently does... (Frankly, I hadn't even noticed it was doing that until very shortly ago. :S)


Latest works
The Strongest

Drake

  • *
Re: Touhou 14: Editing certain image types?
« Reply #9 on: June 02, 2013, 07:41:51 AM »
Alrighty. Basically I just did the weird translation patching thing without applying any patches and played through the game enough times to have it generate the anm files and see if there was a difference.

In any case, the extracted data seems to be complete now. thtk definitely does not work properly with th14. I'm also not certain that thanm even works properly, since for a few anm files it gives the @ and @r lines that usually indicate some sort of error.
« Last Edit: June 02, 2013, 07:44:56 AM by Drake »

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -