Solved

Add large data chunk in a .PNG image using C#

Posted on 2013-11-01
5
806 Views
Last Modified: 2013-11-17
Hi,

I need some opinion and tips. We are having a "drawing tool" that save to .png file but now we need to keep track of some vectorial data.

We get in the idea of adding a "data chunk" but we are note familiar with the format itself. We found that Adobe fireworks seem to do that kind of trick. Defining our own file format get things more complicated and lot less user firendly, the file cannot be emailed and need to "teach" file format differences.


- Do you find this an acceptable solution?
- Any tips or c# library that can help to add and reread our data insinde the png
- Any chunk size limitation?

Thanks
0
Comment
Question by:TelDig
  • 3
  • 2
5 Comments
 
LVL 16

Expert Comment

by:hjgode
Comment Utility
I would not go with a new format. You may either select one of the compound graphic file formats, like EPS, or, what I prefer, save the vector data in a separate file with the same name.
To save the vector data, you need to keep an array of drawing commands and then 'translate' these commands to svg, eps or similar drawing file.
If you can translate the drawing to eps (postscript) you may also use a pdf file for export/import, see the iTextSharp library.
0
 

Author Comment

by:TelDig
Comment Utility
The issues here is that we must keep a flat image format (ex: png or jpeg)
0
 
LVL 16

Expert Comment

by:hjgode
Comment Utility
You cannot use a bitmap file to store vector data. So either you go with two files (most comaptible) or hybrid file format (pdf) or possibly add your drawing data at the end of the png/jpg file. I do not know, what happens with apps, when they open a file with added file data at end of normal file.
0
 

Accepted Solution

by:
TelDig earned 0 total points
Comment Utility
The PNG file format have been designed such way.

You can add additionnal data chunk that will be invisible to other applications. (they call that Ancillary chunks) Some are defined but you can create your custom/private chunk. whey will be ingnored from decoder

We have performed a small prototype using this library : https://code.google.com/p/pngcs/

- It worked well. even with an extra 20MB of "junk"
- Lots of tool that compress/shrik png file will strip all those chunk to keep only the image
- We assume that good chance a user that open the file in an editor will will remove our data but it's what we prefer anyway.
0
 

Author Closing Comment

by:TelDig
Comment Utility
My question / My answer
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I. Introduction In a previous article (http://www.experts-exchange.com/Web_Development/Document_Imaging/A_6537-PaperPort-Upgrade-How-to-download-and-install-updated-versions-of-PaperPort-11-and-12.html) (now deprecated), I discussed how to upgrad…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The goal of the tutorial is to teach the user how to use import presets downloaded from the internet into Adobe Lightroom. Once you downloaded the presets go into the preset folder and press import then import your preset and your set it to go.
The goal of the tutorial is to teach the user how to remove a natural vignette your photos and how to add vignette to your photos.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now