When you import an image into your REAlbasic project you may or may not realize that upon compiling, Rb converts the image into an uncompressed internal format (BMP or PICT most likely). It may even mangle it in some other fashion, such as ignoring the alpha channel.
Losing your alpha channels is an obvious problem, and another potential issue is a increase in application size. That 50Kb PNG file you've imported may convert to a 500Kb resource - add a few more images and you could hit a resource size limit on some build targets.
One workaround is to keep your images external and load them at runtime. Here again you may run into some alpha channel issues but at least your carefully compressed images remain compressed till they're needed.
Another solution is to trick the IDE into treating the image files as strings, then use a plugin to convert the strings into Picture objects. Several plugins can manage this conversion - my own
PNG Utilities,
Einhugur's GraphicsFormats, and the
MBS Plugins to name a few. Now for the "trick" part: Before importing the images into your project, change the file extension to ".txt" or ".dat" (or anything else Rb won't recognize as an image file format). If you're running the Mac OS X IDE you may also need to change the file type to "TEXT" or remove it entirely. A bit of freeware such as
Quick Change will manage that easily enough.
Once your images are in the IDE and the IDE thinks they're plain old strings you can have at them with the plugin of your choice.
... This entry was inspired by a recent thread on the Rb NUG, but similar questions have shown up on the NUG, forums, and in my email box from time to time. Hopefully someone somewhere finds this info useful. ...