?
Solved

read image binary data for output

Posted on 2003-11-04
7
Medium Priority
?
532 Views
Last Modified: 2010-05-01
I'm reading image binary data into a byte array, then parsing out the individual images to output them as .jpg files. However, the output files are only viewable in Photoshop.

Is there a way to create JFIF files or some other format that would be immediately viewable (in apps other than Photoshop)? If not, is there any way to convert my .jpg output files to viewable files?

Thanks.


Brad
0
Comment
Question by:brench
[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
  • 2
7 Comments
 
LVL 3

Assisted Solution

by:NBrownoh
NBrownoh earned 375 total points
ID: 9683476
are you putting more than one image into a file?  or more than one image into an array? If its the first then i would seperate each image into its own file.  If not then i def wouldnt load more than one image into an array.  I would think that those would be your main problems.  Photoshop probably repairs the image to view it since it is a very well written program.
0
 

Author Comment

by:brench
ID: 9686650
NBrownoh,

I put each image into its own .jpg file. When I initially read the binary data from disk, I store it all in the byte array (the file I'm reading in is large--e.g. 150MB). So I have every binary "character" read into the array and then I go through the array, checking for certain characters to tell me where the start and end of each image are. I'm unclear as to why it would cause a problem to load more than one image (or the data for more than one image) into the array.

I noticed that the .jpg file is not in JFIF format. I think that .jpg files will only open in other apps (e.g. Internet Explorer) if they're in this JFIF format. Do you know? I'm really just reading the binary data straight into an output file (from the array) and giving it a .jpg extension. Photoshop, for some reason, is able to translate/interpret the data, but other apps aren't. Do you know how I can generate output that is in the JFIF format, or do you know how I can convert my .jpg output files to JFIF format?

Thanks.


Brad
0
 
LVL 1

Expert Comment

by:Mutare99
ID: 9687210
Where is your binary data coming from?  A source file that contains multiple JPG files crammed into one file?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:NBrownoh
ID: 9688273
Mutare99,

i pretty positive he is just loading multiple images into one byte array.

I dunno, as far as that though.  It just seems like youd be setting yourself up to get knocked down, you could use a multi dimensional array like pic(1, x) x being the current picture number you are loading. or something of that nature.  That might not be your problem in full, but it should at least clean your code up a few lines and help optimize it a little.  As far as jpeg encoding goes i played with it a few years ago and never really got the hang of it since i wasnt as good back then as i am now.  didnt understand classes and how to use them :)
0
 
LVL 1

Accepted Solution

by:
Mutare99 earned 375 total points
ID: 9688705
Well, I guess I'm wondering if the original JPG files will open in apps other than photoshop, or if they are messed up to begin with?  If they work to begin with, then I'd say the cramming them all into one byte array might be messing something up.  But, if they're bad to begin with, converting them to a more recognized JPG format is the real issue.  If so, here is a great site for file formats that may be able to help you convert them to a working form:

http://www.wotsit.org/search.asp?page=5&s=graphics
0
 
LVL 3

Expert Comment

by:NBrownoh
ID: 9688739
thats exactly what im thinking.
0
 

Author Comment

by:brench
ID: 9694542
I was able to solve the problem I was having.

I'm reading binary data from a file given to us on CD. Yes, there are multiple images within the file. Text containing data precedes each image so I have to extract the data (which contains info related to the image) and then extract the image. I should make clear that I'm not starting with .jpg files. It's just a bunch of binary data that I output to a file (and then load to a database).

Once the data is output, the resulting file would not open in anything but Photoshop. What we realized is that the first few lines of data output were not necessary and were in fact causing the file to not open (except in PS). We simply started our output at a different point and the resulting .jpg file opens fine (e.g. in IE, Paint, Windows Picture and Fax Viewer).

Basically, if you look at a .jpg file in Notepad, you'll notice that it starts with something like "ÿØÿà JFIF". Once I output the binary data so that the file started at this same point, the images were viewable. Don't know if I'm being clear on this. If you want more details, let me know.

Thanks for your input.


Brad
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month10 days, 18 hours left to enroll

770 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