Solved

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

Posted on 2013-11-01
5
886 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 16

Expert Comment

by:hjgode
ID: 39619093
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
ID: 39622541
The issues here is that we must keep a flat image format (ex: png or jpeg)
0
 
LVL 16

Expert Comment

by:hjgode
ID: 39623394
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
ID: 39642497
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
ID: 39654326
My question / My answer
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this Micro Tutorial viewers will learn the basic shortcuts and functions in InDesign.
The goal of this is to tech the user how to export photos out of Lightroom and the different options they have. Select which photos you want to export : Select where you want to export and with which options : Export :

690 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