Image encryption

Monkey Forums/Monkey Programming/Image encryption

dragon(Posted 2012) [#1]
Do someone have a idea how i can protect my image files?

For best compression i must save image as png/jpg first.
Then i can encrypt files with custom blitzmax-code and save to new file.

But how can i load that files in monkey?
I can use DataBuffer.Load() to load file and then i can decrypt it.
But after that... how can i send it to png/jpg-loader?


Gerry Quinn(Posted 2012) [#2]
Use CreateImage() and WritePixels()?


dragon(Posted 2012) [#3]
WritePixels need data in RGBA-format,
but DataBuffer.Load() + decryption = _compressed_ format (png/jpg)

I need something like:

LoadImage(stream)
instead of LoadImage(string)


Gerry Quinn(Posted 2012) [#4]
Ah, okay.

If you look at mojo, it calls a native function LoadSurface() to load images, which in turn calls OS functions of the particular device. You will have to modify this and/or the LoadImage() function in mojo I think.


Samah(Posted 2012) [#5]
*presses printscreen*


Gerry Quinn(Posted 2012) [#6]
Printscreen was my first thought as well, but I think he wants to encrypt a JPG into a format like a zip, and then load that.

You can indeed use printscreen for a form of encryption so long as the format is non-lossy.


dragon(Posted 2012) [#7]
haha...

it is very user-unfrendly using printscreen to load images into a app :)
and where to hell is printscreen on android?


therevills(Posted 2012) [#8]
I think Samah was talking about how easy it is to copy the image via print screen even if they are encrypted.

Why do you want to encrypt your images? How many times do you see other games use the same graphics? Only really popular games have their graphics copied and then its only really fan made games eg Sonic, Mario etc.


Samah(Posted 2012) [#9]
@therevills: I think Samah was talking about how easy it is to copy the image via print screen even if they are encrypted.

Yep.

To be honest I don't think there's much point. If a person really wants your images, they'll get them. It doesn't matter how clever your encryption is.


Gerry Quinn(Posted 2012) [#10]
I agree for the most part, but if you have level maps etc. stored as images you might want to make those a bit more difficult to get at.

What I thought Samah meant is that you can do a sort of image encryption by jumbling the image (on your own PC), showing it on screen, using PrintScreen to copy it into your favouite paint program, and saving the jumbled image in a non-lossy format such as PNG.

Then your release version can contain only the jumbled image, which it loads and performs a reverse jumble to decrypt.


dragon(Posted 2012) [#11]
Why do you want to encrypt your images?


It is a hard work to create some good graphics.
I dont like that someone can easy grab images, recreate it and just copy the game.

I feel that Monkey can not load image ressources from memory or stream like BlitzMax.

So only solution is: load image and "scrabble" (not really encryption) it with some compresion-friendly code and then save as normal image.


Nobuyuki(Posted 2012) [#12]
You have at your disposal: the DMCA

Seriously, if someone is literally copying your original game assets and making a clone game with them, that is a textbook case for a takedown request. Anything more minor than that, and you probably don't have much to worry about, I think. People are going to make FAQ's, strategy guides, and maybe even sprite sheets from time to time, but probably not unless your game is popular enough to warrant it. If it is popular enough, well then lucky you, you should enjoy some nice success :)

A simple deterrent to ripping may be to obfuscate the data slightly, like packing it with a compression algorithm, and unpacking it during runtime. I believe there is a tutorial for this somewhere on the forums. The biggest problem you're gonna have with protection is the relative lack of Monkey's ability (until recently?) to natively stream data straight from your data source into memory, and then from there into a bitmap without dumping the data somewhere on the hard drive unencrypted first, where it can be casually ganked. Even then, it can be ganked easily depending on what platform you're targeting (and any solution you could come up with would have to work on all of your targets, which can be a pain).

How much is it worth avoiding a few minor inconviniences vs. just jumping through the copyright hoops for the most serious offenders? Most people ganking assets for games want them typically for innocuous uses, like for fansites or whatever. That's just my personal opinion, of course.

http://www.monkeycoder.co.nz/Community/posts.php?topic=1829

here's the compression code I was mentioning earlier


Shinkiro1(Posted 2012) [#13]
You really don't have to worry. If somebody steals your graphics, well, that's against copyright law.
And as Nobuyuki mentioned, if somebody writes an article about your game, creates a fansite, that's something rather positive I would say as it is free advertising for your game.


Rex Rhino(Posted 2012) [#14]
The safest thing to do, if you don't want your graphics stolen, is to not release your game. If you don't give your graphics to the public, they can never steal it.

However, if you release something to the public, you can't control what people do with it, beyond basic copyright protection.


dragon(Posted 2012) [#15]
Some apps are only "zipped", so you can unzip and copy images with 2 mouse clicks.

With a bit protection this not not so easy.
The cracker must decompile binaries or inject some code into it or decrypt the image with a key (bruteforce).

It is also possible to make a screenshot, but with massive quality loss.
images are often scaled down and here is no alpha-channel on screen.