JPEG to array, the fastest way possible 
Author Message
 JPEG to array, the fastest way possible

I need to convert jpeg files to a byte array, where I process them for
various things, in the fastest way possible.

I have been though this news group where people use getDIBit etc, but
this requires loading the file to a picture box to get the device DC.

Is there any way to read the file directly from disk into a byte array
?

What would be the fastest method to achieve this. Speed really is THE
issue.

Thanks

Stu-man



Sat, 02 Oct 2004 14:18:34 GMT  
 JPEG to array, the fastest way possible
Really, if you read straight from disk to a byte array you will need to
render the the JPEG into a BMP. A PictureBox or using the IJL
(www.intel.com) for direct loading is the best way.

Max Bolingbroke



Sat, 02 Oct 2004 23:32:34 GMT  
 JPEG to array, the fastest way possible
Hello!

The easiest way to perform this task is to use the built-
in commands Open and Get. You need to open the file for
Binary Access Read and then fill the array with the data
by using Get. More information on these commands can be
found in VB documentation. This is not equiavalent to the
version that uses a DIB because you read the content of
the file. Manipulating data in the byte array will corrupt
the image. Remember that the data you read from the file
contains the header and the encoded image data. Opening
the file and showing it in a picturebox converts it into a
Bitmap.

Regards,
Herfried K. Wagner

Quote:
>-----Original Message-----
>I need to convert jpeg files to a byte array, where I
process them for
>various things, in the fastest way possible.

>I have been though this news group where people use
getDIBit etc, but
>this requires loading the file to a picture box to get
the device DC.

>Is there any way to read the file directly from disk into
a byte array
>?

>What would be the fastest method to achieve this. Speed
really is THE
>issue.

>Thanks

>Stu-man
>.



Tue, 05 Oct 2004 18:10:16 GMT  
 JPEG to array, the fastest way possible

Quote:
> The easiest way to perform this task is to use the built-
> in commands Open and Get. You need to open the file for
> Binary Access Read and then fill the array with the data
> by using Get. More information on these commands can be
> found in VB documentation. This is not equiavalent to the
> version that uses a DIB because you read the content of
> the file. Manipulating data in the byte array will corrupt
> the image. Remember that the data you read from the file
> contains the header and the encoded image data. Opening
> the file and showing it in a picturebox converts it into a
> Bitmap.

Also you'll need to take into account that rendering the JPEG onto a picture
box will convert the image to a DDB, not a DIB and as such you'll be limited
to the screen bit-depth.  If you use the IJL from www.Intel.com to decode
the JPEG image then it will return a 'true' Device Independent Bitmap.
Hope this helps,

    Mike

 -- EDais --

 - Microsoft Visual Basic MVP -
WWW: Http://EDais.earlsoft.co.uk/




Tue, 05 Oct 2004 19:37:23 GMT  
 JPEG to array, the fastest way possible
Hi!
You should
open the file in binary mode: open [filename] for binary as #1
read the data to a byte array (only in steps ~16000 bytes)
   get #1,byt() or
   byt()=input(#1,16000)
//I'm not sure if the syntax is completely right!//
close the file close #1
Hope that helps, Joe

Quote:

> I need to convert jpeg files to a byte array, where I process them for
> various things, in the fastest way possible.

> I have been though this news group where people use getDIBit etc, but
> this requires loading the file to a picture box to get the device DC.

> Is there any way to read the file directly from disk into a byte array
> ?

> What would be the fastest method to achieve this. Speed really is THE
> issue.

> Thanks

> Stu-man

--
___________________________________
Joachim Reiter
Student of Technical Mathematics
Graz, University of Technology, AUSTRIA



Sun, 10 Oct 2004 00:50:31 GMT  
 JPEG to array, the fastest way possible
<snip snip>

Quote:
> // I'm not sure if the syntax is completely right! //

Not really..  Here's a fixed version:

'***
Dim FNum As Integer
Dim FileName As String
Dim Byt() As Byte
Dim FileSize As Long

FNum = FreeFile
FileName = "X:\Path\File.xyz"

On Error Resum Next
FileSize = FileLen(FileName)
On Error GoTo 0

If FileSize Then
    ReDim Byt(FileSize) As Byte
    Open FileName For Binary As #FNum
        Get #FNum, , Byt()
    Close #FNum
End If
'***

Hope this helps,

    Mike

 -- EDais --

 - Microsoft Visual Basic MVP -
WWW: Http://EDais.earlsoft.co.uk/




Sun, 10 Oct 2004 03:20:33 GMT  
 JPEG to array, the fastest way possible
Thanks, I will give this a try and let you know how it goes.

Stu-man



Sun, 17 Oct 2004 13:33:45 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. All the possible ways to create an attachment

2. Intel 1.1 Intel JPEG Library is FAST but...?

3. Help: VB3: Arrays of arrays possible?

4. Is it possible to resize JPEG files with ASP and VBScript

5. Hello Plz I want to help as fast as possible Visual Basic

6. VB4 - Is it possible to fast forward thur CD

7. Wanted Some Info - AS FAST AS POSSIBLE

8. How to find files as fast as possible

9. Fastest bitmap update as possible

10. jpeg file in byte array --> Picture object

11. jpeg file in byte array --> Picture object

12. jpeg file in byte array --> Picture object

 

 
Powered by phpBB® Forum Software