473,785 Members | 2,714 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Detecting Progressive JPEGs in ASP.NET

Hello .NET Gurus!

I have been posting messages all over the .NET forums to no avail, so I
thought I'd give this newsgroup a shot as well.

I am trying to figure out how to detect if a user-uploaded JPG file is in
Progressive or Baseline format. I need to determine this because the display
mechanism I am using (namely, flash) is not capable of displaying
Progressive JPGS. I have succesfully managed to detect the mime-type of the
files, but they always show as image/pjpeg, even when it's not a progressive
jpg file.

The closest I have gotten is that I did discover the RenderProgressi ve and
RenderNonProgre ssive members of the EncoderParamete rs enumeration. However,
these appear to be "write-only", e.g. they can be applied to the Encoder
object as parameters for encoding an existing file... but they can't be used
as a means by which to determine the properties of an existing file.
Furthermore, in the .NET docs on MSDN, these two parameters are documented
as being "Not used in GDI+ 1.0"

Lastly, I want to mention that using PHP it seems to be possible to detect
progressive jpgs by reading the binary code and looking for certain markers
or patterns using the following script.... But this is way over my head as
far as how to convert this code to somthing in VB or C#. So, forgive me for
posting PHP on a microsoft forum ;P ... but this is the only solid lead I
have!

<php code>
$fp = @fopen( $filename, "rb" );
$imageData = fread( $fp, 100000 );
@fclose( $fp );

function checkImage($ima geData) {
if ( strstr( $imageData, pack( "n", 0xFFC2 ) ) ) {
return false;
}
if ( strstr( $imageData, pack( "n", 0xFFC6 ) ) ) {
return false;
}
if ( strstr( $imageData, pack( "n", 0xFFCA ) ) ) {
return false;
}
return true;
}
</php code>


Jul 21 '05 #1
0 1141

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

Similar topics

3
3430
by: Aaron Davies | last post by:
I'm trying to write some classes for my collaborative whiteboard to transmit images over the network, using the javax.imageio API, but I'm running into an odd problem: my code words fine with PNGs, but not with JPEGs. As you can see below, I've attached a progress listener to the reader, which reports progress up to just under 95%, then nothing. The warning listener reports no warnings. The images are written by an ImageWriter in another...
0
1500
by: Dianne Combs | last post by:
Dear Online Reader or Editor ... If you could ... please take a look at our new online treeless edition newspapers, The Northeast Progressive Advocate-Journal and our sister newspaper the San Francisco Bay Gazette, which are produced exclusively by our joint staffs to serve the Northeast and West Coast areas - with additional non-mainline media perspective. News stories and columns are researched, thoughtful and blend politics with...
5
2997
by: Pecos Bill | last post by:
Hi to everybody, I'd like to know how to extract a progressive number in a select. Example.. Select * from employers Name Surname Position Age Hire Date Progressive Mario Rossi Consultant 25 26/07/2003 1 (this field doeas not exists in table) fredrick Bauman Secretary 30 15/06/1999 2
3
3071
by: Girish | last post by:
Hi All, I have written a component(ATL COM) that wraps Xerces C++ parser. I am firing necessary events for each of the notifications that I have handled for the Content and Error handler. The events can then I am able to parse XML input in the form of files. I also have provided support for parsing of XML content in the form of string data. I am able to do so by creating a MemBufInputSource object using the XML content provided to the...
1
4067
by: Chris Jakeman | last post by:
Hi, Internet Explorer doesn't load JPGs progressively. I need to show a large graphic (100KB) on dial-up lines, so I searched for a way to emulate progressive loading of images. Couldn't find anything, so I've written my own, with bands of low-res image being loaded and then overwritten with high-res. Have I been re-inventing the wheel?
1
3683
by: Carlo | last post by:
I have a table with a lot of fields. One is a numeric field. How can I introduce in these field a progressive number. I have to change at times the start number. example: 55,56,57,58,59,60,134,135,136,137
0
846
by: Ryan Cooper | last post by:
Hello .NET Gurus! I have been posting messages all over the .NET forums to no avail, so I thought I'd give this newsgroup a shot as well. I am trying to figure out how to detect if a user-uploaded JPG file is in Progressive or Baseline format. I need to determine this because the display mechanism I am using (namely, flash) is not capable of displaying Progressive JPGS. I have succesfully managed to detect the mime-type of the files,...
0
1413
by: nhacnhac | last post by:
Hi Guys does anyone knows if the a JPEG file saved as JFIF version 1.02 is always considered progressive? I need to create a program in C# to open JPEG files and upload just the non-progressive JPEG files. I'm trying to find information about how to identify a progressive and non-progressive JPGE image, but I'm stuck. Does anyone knows if I can find the progressive information just analysing the JPEG header or that is part of the...
5
6008
by: byteit101 | last post by:
I am working a an Image processing program, and I want to save my jpegs as being progressive (blurry to sharp instead of line by line while it loads). this does not work howerver: ImageCodecInfo iciJpegCodec = null; EncoderParameter epQuality = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 98L); ImageCodecInfo iciCodecs = ImageCodecInfo.GetImageEncoders(); EncoderParameters epParameters = new EncoderParameters(2);...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10319
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9947
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8971
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7496
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.