473,386 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Manually crating JPG file from array of bytes

Hello.

I need to create JPG file base on data from some array of bytes without
using any graphical functions.
So I need the function which will get array of bytes as parameter and write
it byte by byte into file, of course there must be inserted all necessary
data appropriate of JPG format (headers compression and etc...).
Can anybody show me how can I implement such function?
Also does anybody know where can I find detailed information about JPG
compression algorithm?

Thank you.
Nov 16 '05 #1
2 5326
David,

I would ask why you can not use any graphical functions?

That aside, what kind of information is in the byte array? It obviously
isn't in a JPG format already, because if it was, you could just save the
whole byte array to disk and be done with it.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"David" <da*********@hotmail.com> wrote in message
news:e3****************@TK2MSFTNGP10.phx.gbl...
Hello.

I need to create JPG file base on data from some array of bytes without
using any graphical functions.
So I need the function which will get array of bytes as parameter and
write it byte by byte into file, of course there must be inserted all
necessary data appropriate of JPG format (headers compression and etc...).
Can anybody show me how can I implement such function?
Also does anybody know where can I find detailed information about JPG
compression algorithm?

Thank you.

Nov 16 '05 #2
Try creating an Image object from the byte array first, something like:

MemoryStream ms = new MemoryStream(myByteArray);
Image i = Image.FromStream(ms);
i.Save("i.jpg", ImageFormat.Jpeg);

It might work if the initial byte array was created from image data.
Otherwise you will need to encode it yourself. There are many reference
implementations of jpeg encoding but you can always start here:
http://www.ijg.org/

ok,
aq

"David" <da*********@hotmail.com> wrote in message
news:e3****************@TK2MSFTNGP10.phx.gbl...
Hello.

I need to create JPG file base on data from some array of bytes without
using any graphical functions.
So I need the function which will get array of bytes as parameter and write it byte by byte into file, of course there must be inserted all necessary
data appropriate of JPG format (headers compression and etc...).
Can anybody show me how can I implement such function?
Also does anybody know where can I find detailed information about JPG
compression algorithm?

Thank you.

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: chris | last post by:
I'm writing a small app to help me learn more about cryptography. All it does is encrypt all of the files in directory A, and put the encrypted versions of the files in directory B. It then...
11
by: Abhishek | last post by:
I have a problem transfering files using sockets from pocket pc(.net compact c#) to desktop(not using .net just mfc and sockets 2 API). The socket communication is not a issue and I am able to...
1
by: Andre Ranieri | last post by:
I'm having trouble programatically inserting an Excel file into an Image column in our CRM package's SQL 2000 database. The function appears to work ok, but when I attempt to access the file through...
6
by: Neil Patel | last post by:
I have a log file that puts the most recent record at the bottom of the file. Each line is delimited by a \r\n Does anyone know how to seek to the end of the file and start reading backwards?
2
by: simonc | last post by:
Is there an easy way of writing a number in 32 bit integer format into four bytes of a file? I am experimenting with FilePut but I can only make it work by defining a four byte array and doing some...
4
by: Phillip Ian | last post by:
Version: VS 2005 I took the sample code from help about encrypting and decrypting strings, and changed it to work directly with byte arrays and get the key and IV values from functions I've...
5
by: philip | last post by:
Here is some lines of code than I wrote. You can copy/paste theis code as code of form1 in a new project. My problem is this one : I try to write in a file a serie of bytes. BUT some bytes...
2
by: Bonzol | last post by:
vb.net 2003 Windows application We have a Client/Server system set up by communicating through a TCPClient object. The server loops continuously using a tcplistener device and each time a client...
11
by: Freddy Coal | last post by:
Hi, I'm trying to read a binary file of 2411 Bytes, I would like load all the file in a String. I make this function for make that: '-------------------------- Public Shared Function...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.