I like my own picture formats

Well, as I am programming card games, i am dealing with pictures.
I don’t like very much that Xojo transforms all my picture formats to png format in the resources. I am thinking a lot about what my picture formats are And the worst is that it even transforms my transparent channel png’s to non transparent ones.
And about stealing my pictures…a frx data file like in VB…i would appreciate very much…athough being hacked without problems by profs…but not every day users.

I don’t know what format(s) you prefer, but hold down Option when dragging into the IDE and jpegs will remain jpeg in Resources,

1 Like

If you don’t want your pictures to be accessible without your application, what about storing them in an encrypted SQLite database?

You can load them on the fly in your code and it will never be seen on disc.

1 Like

It is also possible to embed images in your app, using the Picture.ToData() method and the EncodeBase64() function.

Var s As String = EncodeBase64(myPic.ToData(Picture.Formats.JPEG)

You might need to build a little tool around the above code, to encode the image outside of your app project, then copy-and-paste the string into a constant in your app.

Then when you want to display the image, you do something like:

Var p As Picture = Picture.FromData(DecodeBase64(Self.myConstant))

Of course, this will bloat the app somewhat, but again, the picture file is not left exposed in the resource folder of your app. I don’t know if this kind of encoding conversion back-and-forth will effect the quality of the picture, but it works fine for icons that have transparent backgrounds.

1 Like

You can also use a build step to copy files in the Resources folder.
Files won’t be altered by Xojo.

1 Like

That’s a good one. Another trick: rename your picture before dragging it into the IDE, e.g. from picture.jpeg to picture_jpeg.dat and the IDE won’t change the format.

1 Like

Uh, Xojo has supported transparent PNGs for a long time.

2 Likes

First, that is not true. It does not convert it to non transparent.
And secondly, why do you think it only supports PNG? It can hold and use BMP, GIF, HEIC, JPEG and TIFF too.
And thirty, aren’t there enough card games available yet? :wink:

Are-you using Windows ?

Black replace the transparent parts ?

Thank you very much for your helpful replies :slight_smile:
@Julia_Truchsess
It works. I tried it out with png tiff and jpg. Although jpg only if its named .jpeg not working with .jpg.

@Daniel_Fritzsche
I will try it out sometimes, thank you a lot. But first learning more about databases necessary for me.

@Scott_C @Jeremie_L @Mike_D
Thanks a lot too, i will try it out too.

@Thom
It supports, yes. But only if I copy my own transparent pngs to the resources folder.

@Emile_Schwarz
Yes and yes :slight_smile:

1 Like

Works with *.jpg for me under Xojo 2021r2.1, but maybe it’s changed since then. The timing of holding Option and dragging can be finicky, and sometimes you have to try more than once.

Well… no. Dragging them into my project is precisely what I do. Take a look: Beacon/Project at master · thommcgrath/Beacon · GitHub

There’s nothing fancy going on. I drag the file in, and it works. Even before multi resolution images, it worked.

I think it doesn’t work if you set the transparent property of the image in the project, as you’re telling Xojo to ignore the alpha channel and make a new one. But honestly, this is just a guess because I have literally never used that property in my extensive time with Xojo. I think it’s stupid and should go away, if it hasn’t already.

It is a Windows behaviour…