Jump to content
How to Install Plugins ×

Base64 FileType (2022-06-03)


null54

Recommended Posts

This plugin loads and saves Base64 encoded images.
 
Only BMP and PNG format images can be saved.
The format of the text file is UTF8.

 

This plugin is compatible with Paint.NET 3.5.11 and 4.0.x.

 

On 8/12/2015 at 7:45 AM, midora said:

The file extension is .b64
A b64 file contains a png or a bmp image encoded as base64 text.
Open a .b64: The filetype plugin decodes the text of the file back to the contained png or bmp image and then opens this image in paint.net.
Save as .b64: The filetype plugin takes the open image, converts it to png or bmp (there is an option in the dialog), converts the result to base64 text and then saves the text.

 

btn_donate_SM.gif

Download:

 

Base64FileType.zip

 

Source Code:

 

https://github.com/0xC0000054/pdn-base64

  • Upvote 4

PdnSig.png

Plugin Pack | PSFilterPdn | Content Aware Fill | G'MICPaint Shop Pro Filetype | RAW Filetype | WebP Filetype

The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait

 

Link to comment
Share on other sites

Great.

Can you add a few setting to prepend the code with the correct base64 syntax "data:image/png;base64,".

And maybe an option to build the HTML tag for an image or CSS for background image...

Link to comment
Share on other sites

Great.

Can you add a few setting to prepend the code with the correct base64 syntax "data:image/png;base64,".

And maybe an option to build the HTML tag for an image or CSS for background image...

 

Added a Data URI format check box, HTML and CSS formats can be selected from a list.

File version updated to 1.0.0.1.

PdnSig.png

Plugin Pack | PSFilterPdn | Content Aware Fill | G'MICPaint Shop Pro Filetype | RAW Filetype | WebP Filetype

The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait

 

Link to comment
Share on other sites

What's about a raw option (just the BGRA data)?

 

Do you mean encoding the raw pixel data without saving as BMP or PNG first?

PdnSig.png

Plugin Pack | PSFilterPdn | Content Aware Fill | G'MICPaint Shop Pro Filetype | RAW Filetype | WebP Filetype

The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait

 

Link to comment
Share on other sites

  • 7 months later...

Sorry I totally missed your response.

 

Sometimes I need a  raw base64 BGR or RGB stream. But I can always use a tool to convert it.

 

Two non-important issues:

 

1)  If you are using file format BMP and set the HTML or CSS option then the loader part is not always able to load the file (you can also see this in the save dialog that the file size always tells "computing...". )

 

2) If you are setting URI data type to HTML and then switch off DATA URI encoding then the Insert line break checkbox stays disabled. You first have to set URI data type to None. Seems to be a small issues with the IndirectUI rules.

midoras signature.gif

Link to comment
Share on other sites

Thanks. But now in both cases (html and css) the plugin is not able to load and does not stop computing.

 

>>The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.

 

There is an other thing you may think about. It's about the extension. I would prefer that the plugin uses .b64 instead of .txt.

In my case .txt conflicts with a plugin which loads .txt files as bitmaps. So I always have to decide what to install.

midoras signature.gif

Link to comment
Share on other sites

Thanks. But now in both cases (html and css) the plugin is not able to load and does not stop computing.

 

>>The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.

 

There is an other thing you may think about. It's about the extension. I would prefer that the plugin uses .b64 instead of .txt.

In my case .txt conflicts with a plugin which loads .txt files as bitmaps. So I always have to decide what to install.

 

I cannot reproduce that error.

 

As for the extension it would be en easy change.

PdnSig.png

Plugin Pack | PSFilterPdn | Content Aware Fill | G'MICPaint Shop Pro Filetype | RAW Filetype | WebP Filetype

The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait

 

Link to comment
Share on other sites

Maybe it depends on the file. So here is a file which is always showing computing (in 3.5.11 and 4.0) if HTML or CSS is selected.

FLAG_B24.zip

 

I verified that in both cases 1.0.0.3 is in the FileTypes folder.

I would prefer the change of the extension. Especially because it is not a standard user file content.

Edited by midora

midoras signature.gif

Link to comment
Share on other sites

That issue is fixed, and the file extension has been changed.

File version updated to 1.0.0.4.

PdnSig.png

Plugin Pack | PSFilterPdn | Content Aware Fill | G'MICPaint Shop Pro Filetype | RAW Filetype | WebP Filetype

The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait

 

Link to comment
Share on other sites

  • 1 year later...
  • 2 months later...

Hello,

 

I am sorry, but how can I use this plug in to open an image from base64 string. I have added the dll to the plugins folder, but don't know how to use it.

Link to comment
Share on other sites

This is a filetype plugin. It should be placed in the \Filetypes\ folder. You access the new file types via the list of extensions in the load/save dialogs.

Link to comment
Share on other sites

Thank you for your answer. Such folder did not exist, so I created it and placed the DLL inside: C:\Program Files (x86)\Notepad++\FileTypes, however, I don't see new option: http://screencast.com/t/OrU7lKK6rogC

 

Furthremore, should I save the base64 string in a file and open it with this extension. And if so, what the file extension should be?

Link to comment
Share on other sites

The description of the filetype is quite compact, I agree ;-)

 

The file extension is .b64

A b64 file contains a png or a bmp image encoded as base64 text.

Open a .b64: The filetype plugin decodes the text of the file back to the contained png or bmp image and then opens this image in paint.net.

Save as .b64: The filetype plugin takes the open image, converts it to png or bmp (there is an option in the dialog), converts the result to base64 text and then saves the text.

midoras signature.gif

Link to comment
Share on other sites

The file extension is .b64

A b64 file contains a png or a bmp image encoded as base64 text.

Open a .b64: The filetype plugin decodes the text of the file back to the contained png or bmp image and then opens this image in paint.net.

Save as .b64: The filetype plugin takes the open image, converts it to png or bmp (there is an option in the dialog), converts the result to base64 text and then saves the text.

Excellent summary Midora! I've added this to the first post.

Link to comment
Share on other sites

  • 7 months later...

I needed to save a file in b64 today (to embed it into a web page) and I thought I would have to download some spyware laden "freeware" program to do the conversion. Ugh. Then I thought... I bet someone has written a filetype plugin for paint.net!

null54, thanks for making this plugin. It worked like a charm!

Link to comment
Share on other sites

I needed to save a file in b64 today (to embed it into a web page) and I thought I would have to download some spyware laden "freeware" program to do the conversion.

 

Just for completeness: For that reason online converters exist like this one:

 

https://www.base64-image.de/

Edited by IRON67
Link to comment
Share on other sites

Hmmm... plugin may have a bug in it...

I'm trying to do about 20 of these little images and I notice that many times when I go to save one, it will never show me the preview. It sticks saying, "(computing)" and never finishes. If I press Save when it is in this state, it never saves the file and I have to kill paint.net with the task manager.

Can you look into it and possibly fix?

The files I'm trying to save are small, 16x16 icons with some transparency which is why I can't use BMP format (which always seems to work).

I've used it successfully to save larger images, so I'm not sure what the problem is.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...