What do you think about storing images inside the plugin?

ArkDG

Veteran
Veteran
Joined
May 26, 2013
Messages
143
Reaction score
48
First Language
portuguese
Primarily Uses
As I was working with my Save Engine plugin, I learned a lot about managing files and storing images in the form of a "URI data" (or base64 encoded image, as corrected me Hudell) inside the plugins, so I can call it without the developper needing to download them in separated  zip files and install inside any folder of his game.

I want to share the idea and hear your opinions about that.

It's not that the developper can't customize the pictures he will use, it's just that if he don't customize, he either won't need to downlaod a zip or rar file with the images and save then inside the proper folders, because everything is inside the script. It's really easy to convert a picture to code and store it into variables. I used this site:

http://websemantics.co.uk/ (on Image to data URI Convertor)

And to store I just made this:
 

var my_stored_bitmap_name_ = 'base64 encoded image'Practical example:



var savefileface_arksavescreen_engine = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJAAAACQCAMAAADQmBKKAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAASZQTFRFAAAA/////A0Q/Bwf/zMzvoGC+UdMZjMz63B5mTMzzJmZoFNg64yf4qK/eDlgtYyv0bLa5dXv28vvMzMzuazWw7/vZmZmzMz/QEBQlZW6b2+Ig4OfZWV73d3/mZnM4eH/zMzf7Oz/oqKvDw8QUVFSu7u87PD/0dz/or3/qsP/u8//2+X/Zpn/eaX/jbL/4uz//cyK/d+5/unO//Tm9r6B8K1u55lf35hn3YJKzGYzxW9MtlY6qzASoTIj062rmBAM/wAA5wAAzAAAggAAsgEBmQAAUAICGAICiRAQ/2Zm/5mZ/6ysa0tLWkZGmYCA6M/PjYOD39fX9+/v7u7u6enp4+Pj39/fzMzMs7OzqampmZmZgYGBeXl5TU1NRUVFIyMjHBwc////ySzU1QAAAGJ0Uk5T/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////wAQVpKqAAALuElEQVR42uzbi1vTyBYA8AkiUMFd1mi63rXXy50UW2iVt1BBKQEtcnfh0leatEn8//+Je2Ymj8mjeQx19btfz/e5i0jTX885mcxMAvr2kwWag+agOWgOmoN+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mnn4IYjXLfm4pPYY3gzji8uz52UTKgvGbupjQzlyFOpD8ApATPDriP63gobI2rgxzVckHcLcBRNfftxDjIb6I7hIPjV+9YCzmK0ctOTww09O+UFl/b234TRZ6Jq8IEnk76SPUGwyIgY+jf3BbYbLCUkddERhhUrcJ3TRWWRwRVLQ5SxLZjyDaHQZtISQDBuDkyxgosIWzF1IuBTMFNT9bByjj8EBoPYvdPoYIw9TKmgCZxkCEC+sb9gqWdBBp5IPdTw0XTjNcvDKr6N7eFQIGpmpIgb4jRyQ8ZI0OPXO2t+G3bfANRyoOVcNAs0Ej30FWdDDgBCCtKDCQ/CPTNu5blBwXfYb9WgBzosgmpqT8QPQTkFc6x7vRMEPwjX0gFRQLbtp1vqZj5qzjeSJDY03oAGkW6RZZtB2MclT0QxJmwTIanxJ6Ogcb8VpxtO04AezgohLLCnRpvIb97cXx/yLbxrED86ORwqAAUaiEzvNFUbIeoyK9kBSiZnTmj5IpZiQmiW7izBYVQWJ6MjWQQDm3mFtxCE/vdvlCnR0GTKQmyvxsoooJ+gcHP5BNEsRg7jh3atCy8k/8QFR2Ybbr1FgtMcBj9DaAkVlr8TaCYaxry298Lyk7fTwEq/AHmoDloDpqD5qA5aA76Pwf9T4ABAF+qMpoMTMMiAAAAAElFTkSuQmCC';  

Than I just render it:   

    var bitmap = new Bitmap(width, height);        bitmap._image = new Image();                bitmap._image.src = my_stored_bitmap_name;                     bitmap._onLoad();                    this.contents.blt(bitmap, 0, 0, bitmap._canvas.width, bitmap._canvas.height, x, y, width, height);
Code:
if (ark_player_name.length < 4 || ark_player_name[3] == '' || ark_player_name[3] == null || ark_player_name[3] == undefined) {                 var bitmap = new Bitmap(144, 144);        bitmap._image = new Image();                bitmap._image.src = savefileface_arksavescreen_engine;                     bitmap._onLoad();            } else { var bitmap = ImageManager.loadPicture(ark_player_name[3]); }        this.contents.blt(bitmap, 0, 0, bitmap._canvas.width, bitmap._canvas.height, 10, 0, 144, 144);    }
With java script it's fairly easy to even render lots of image kinds, in a lot of diferent extensions, not just png. Then the file size is not a problem, as I can use any kind of compression in my files.

Said that, what do you think?Could this be a common pratice in the future for plugins that need external new images?
 
Last edited by a moderator:

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
863
First Language
German
Primarily Uses
What image is this? I would recommand against it, since the user should have the freedom to use their own pictures, configurable by plugin parameter. If no picture is specified, just leave it empty.
 

ArkDG

Veteran
Veteran
Joined
May 26, 2013
Messages
143
Reaction score
48
First Language
portuguese
Primarily Uses
Well, sometimes, for example, you will have a plugin that requires the developper to download a set of images to works. Without them the plugin would just not work. So, instead of to download these images in a separated zip file, the player can just download the plugin and it will work.

About to cutomize, it's easy to make an if condition that identifies a parameter configuration and change the image if the player configureted it.


In my plugin I called it "default", and if the developper change it for any other name, que plugin will search for the image inside the game folders.

So, the developper can change the image if he wants to. 
 
Last edited by a moderator:

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
863
First Language
German
Primarily Uses
I just took a look at your image and it doesn't seem vital to me, so i would just leave it out of the plugin, since it bloats the file size and uses up space, even if the user doesn't want to use it.

Also, and i may be the only one caring about that, i think it disturbs the overall look of the code.
 

ArkDG

Veteran
Veteran
Joined
May 26, 2013
Messages
143
Reaction score
48
First Language
portuguese
Primarily Uses
Haha, really. The code looks a bit ugly when you do it. A lot ugly.

As I said about the size of the picture, you can compress it to less than 1kb. IF you are obligated to have these pictures for the plugin to work, I see no problem in enlarging the plugin size.

And it's not completely vital, but makes my plugin looks fancy. Without that picture, the aspect of the scene gets too empty.

EDIT PS.: If the developper wants to leave it empty, he can create an empty bitmap or I can set that the  values  ' ', 'null', 'undefined' or even "empty" won't show any picture.
 
Last edited by a moderator:

ArkDG

Veteran
Veteran
Joined
May 26, 2013
Messages
143
Reaction score
48
First Language
portuguese
Primarily Uses
So... No one really wants to talk about it. Then, this topic idea should be a bad idea. Anyway I noticed that plugin stored pictures might be preloaded, or they might have loading time problems to appear when called. Nothing that hard if you know what to do. Woked fine in my plugin.

Maybe an ugly code that, in tesis, your user might never look at, because he just want to use the params, notetags and in rmmv tools that you create, is a real problem. And a script with 10 or 15 plus kbs is too heavy.

So, as this topic was treated like a dumb to talk about thing... Let just forget this idea.
 

Hudell

Dog Lord
Veteran
Joined
Oct 2, 2014
Messages
3,545
Reaction score
3,715
First Language
Java's Crypt
Primarily Uses
RMMZ
I have nothing against it tbh
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,860
Messages
1,017,040
Members
137,569
Latest member
Shtelsky
Top