473,378 Members | 1,156 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,378 software developers and data experts.

convert ppm to jpeg

hi
anyone that know some free code to convert ppm to jpeg in c#?

Best regards
Kim Schulz
Nov 16 '05 #1
3 7659
Kim,

I don't think that GDI supports the PPM format. If you have a library
that supports it, and exposes a GDI device context handle to the image, then
you should be able to create a new Bitmap instance, and then get the device
context for that, calling BitBlt (through the P/Invoke layer), to copy the
PPM image to the Bitmap).

Once you have that, you can then call Save on the Bitmap, indicating
that you want it to be saved in JPG format.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Kim Schulz" <ki*@schulz.dk> wrote in message
news:20*********************@lifesuckz.nork.auc.dk ...
hi
anyone that know some free code to convert ppm to jpeg in c#?

Best regards
Kim Schulz

Nov 16 '05 #2
On Wed, 18 Aug 2004 10:31:19 -0400
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com>
wrote:
Kim,

I don't think that GDI supports the PPM format. If you have a
library
that supports it, and exposes a GDI device context handle to the
image, then you should be able to create a new Bitmap instance, and
then get the device context for that, calling BitBlt (through the
P/Invoke layer), to copy the PPM image to the Bitmap).

Once you have that, you can then call Save on the Bitmap,
indicating
that you want it to be saved in JPG format.

Hope this helps.

what if I have the pixel information directly in an array as RGB ?

Best regards

Kim Schulz
Nov 16 '05 #3
Kim,

If you have that, then you can probably create a new Bitmap of the same
size, and iterate through all the pixels on the original image. With the
pixel information in RGB, you could call SetPixel on the new Bitmap
instance.

Be warned though, this is probably going to be very, very slow.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Kim Schulz" <ki*@schulz.dk> wrote in message
news:20*********************@lifesuckz.nork.auc.dk ...
On Wed, 18 Aug 2004 10:31:19 -0400
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com>
wrote:
Kim,

I don't think that GDI supports the PPM format. If you have a
library
that supports it, and exposes a GDI device context handle to the
image, then you should be able to create a new Bitmap instance, and
then get the device context for that, calling BitBlt (through the
P/Invoke layer), to copy the PPM image to the Bitmap).

Once you have that, you can then call Save on the Bitmap,
indicating
that you want it to be saved in JPG format.

Hope this helps.

what if I have the pixel information directly in an array as RGB ?

Best regards

Kim Schulz

Nov 16 '05 #4

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

Similar topics

3
by: Ming | last post by:
Hi All, I want to write a PHP webpage which allows people to upload images (no matter what formats) to me and at the same time converts any non-jpeg image to JPEG. Here's what I have: ...
3
by: bull.enteract | last post by:
Ok, I start off with a bitmap image. I encode it as a jpeg and send it across the network and pick it up on the other end. Now I have the jpeg image on the other end as an arrray of bytes and I...
16
by: David Lauberts | last post by:
Hi Wonder if someone has some words of wisdom. I have a access 2002 form that contains 2 graph objects that overlay each other and would like to export them as a JPEG to use in a presentation....
2
by: Lucas Cowald | last post by:
Hi, Using ASP and VBScript. How to convert JPEG image into a binary data? Is it possible with a command from ASP / VBScript without having to put it into a database first? I want to take the...
1
by: Daniel | last post by:
I have looked everywhere on the web for an answer to this and the only thing I can find is converting the image format when the file is present on the local filesystem. What I want to do is use a...
7
by: Scott Schluer | last post by:
Is there a way to use the Image class to convert a color photo (GIF or JPEG) to a B&W photo? Thanks, Scott
3
by: Dennis | last post by:
I am trying to convert a bitmap to a JPEG MemoryStream and return a Byte array containing the resulting JPEG Image as follows: Public Function BmpToJPEG(ByVal BitMapIn As Bitmap, ByVal Quality As...
6
by: RaulAbHK | last post by:
Dear all, I guess this is a basic question with an easy answer but I am a beginner and I would much apreciate your feedbacks. Let's say I have a library with some functionality to perform some...
8
by: Skeleton Man | last post by:
Hi guys, I was thinking.. wouldn't it be cool if you could take an image (jpeg) and redraw the entire thing in HTML ? In theory you could parse the image to create an array containing the RGB...
1
by: Joe Cool | last post by:
I am attempting to add a function to an application I am working on to modify the JPEG Comment in a Jpeg image file. I can retrieve the JPEG Comment with no problem. The problem is modifying it....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.