|
hi all,
in my project i need to convert raw image to bmp or jpeg and i have some images with the extention .gry i dont know this is raw or any other special format but i am thinking this is a raw format so my problem is convert .gry image to bmp or jpeg in c#
so plz any one knows the way how to do it is plz tell me
thanks in advance
Regards,
santhosh
|
|
|
|
|
You could use the System.Drawing.Bitmap class to create a bitmap of the appropriate bits-per-pixel
and copy the raw pixel data to it.
Do you have specs for the gry file format?
Mark
"Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens. It's a dumb question... skip it."
|
|
|
|
|
No mark i don't have any specs for that gry file according to my project document i have to take that gry image as input and displaying that into picture box
plz tell me the way how can i read this type of images in c#
and tell if any tutorial for this problem for reference
Regards,
santhosh
|
|
|
|
|
I'm not a C# programmer but C# uses .NET right? If so, check out the System.Drawing.Bitmap
class. If you have the dimensions and pixel format of the raw pixel data then you can create
a Bitmap object with the same format and copy the pixel data into it. Then it can be saved in
a variety of formats.
Mark
"Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens. It's a dumb question... skip it."
|
|
|
|
|
gry (or RAW GREY format) is an image format that is not supported by the image classes in .NET. This means that you are going to have to write your own converter I'm afraid.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Pete O`Hanlon wrote: This means that you are going to have to write your own converter I'm afraid.
I think that's what he wants to do. I'd post a C++ sample but I can't find any info on the
format. How to extract dimensions and pixel format would be helpful!
Do you know the Raw Grey format?
Mark
"Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens. It's a dumb question... skip it."
|
|
|
|
|
I don't use .NET, but the process will generally be the same. So, I'll speak in a bit of a psuedocode to get you pointed in the right direction at least.
Most RAW image files use the .raw extension out of custom although I've heard of .gry too so you're most likely right on that. Just Google for info on the RAW image file header format. To know how to make heads or tails out of the file data.
Here's one actually...
http://download-east.oracle.com/docs/cd/B10501_01/appdev.920/a88786/mm_raw.htm[^]
The good news is, a RAW image is raw data and a breeze to read into a buffer that libjpg or CreateBitmapIndirect() (Windows API) can understand. There are also a lot of unmanaged libs out there that will do this.
HTH
|
|
|
|
|
I have experience in doing graphics in vb5 but I am now using vb.net. I'm a little confused on how the new graphics system works. Could somebody show me some code that will do the eqivelent of the pset method. Also could somebody show me how to read the rgb values of a given pixel.
Thanks in advance for your help,
Mike
|
|
|
|
|
what does pset do ?
GetPixel is the easiest way to get a pixel value on an image.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: what does pset do ?
pset is VB's SetPixel if I remember correctly
Great job, team. Head back to base for debriefing and cocktails.
|
|
|
|
|
Thank you guys for your help. One follow up question. Once you use GetPixel to get the individual pixel, how do you split it into individual colors?
Thank you Christian for refering me to your article, I would use the pointer method but I've already written alot of code for this project in vb.net and correct me if I am wrong but I don't think pointers can be used in vb? In any case speed really isn't that important for this. I'm mainly just using the graphics for testing purposes to see that certain complex functions are working correctly inside my program.
|
|
|
|
|
MikeMarq wrote: Once you use GetPixel to get the individual pixel, how do you split it into individual colors?
The return value of GetPixel is a COLORREF and is a DWORD layed out like this: 0x00BBGGRR
In C/C++ we have the macros GetRValue, GetGValue, and GetBValue to extract the components from
a COLORREF. There's something similar in VB I just can't remember
Mark
"Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens. It's a dumb question... skip it."
|
|
|
|
|
OK, an image has a setPixel method too. But, if you want to set a lot of pixels, you should read my image processing articles, which means you need to do it in C# and call it from a library.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi, I would like to write a program, which would give me a possibility of viewing one computer's screen by some other computers connected via LAN. I've tried to print the main computer's screen (server) using timer, make a jpg file, and send it to other computers (clients) via LAN, which opened given jpg. Unfortunately this method isn't good, because it charges server computer too much. Does anyone know how can I solve this problem?
How can I read and broadcast view of the computer's screen easly?? Maybe I could read display's buffers somehow? Please help me.
|
|
|
|
|
Do you just need snapshots of the screen? If so, then grabbing the screen pixels takes very
little CPU horsepower so reading display buffers will give you little advantage.
The real trick is compressing and sending the pixel data in real time.
Mark
Great job, team. Head back to base for debriefing and cocktails.
|
|
|
|
|
You're looking for a VNC library. If a part of the screen doesn't change, why transmit it? You're just wasting bandwidth doing that. Google for "vnc vb.net[^]" and you'll find some examples.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hello,
can someone tell me how to to render a movie onto two monitors, i've a bit of code that reners the file on a picturebox. When i tell my computer to use two videocards and do the same thing on each screen, only the main screen shows the video / movie. the other shows a black hole. how can i solve that problem.
FilgraphManager graphManager = new FilgraphManager();
graphManager.RenderFile(file);
// Attach the view to a picture box on the form.
try
{
videoWindow = (IVideoWindow)graphManager;
videoWindow.Owner = (int)pictureBox1.Handle;
videoWindow.WindowStyle = WS_CHILD | WS_CLIPCHILDREN;
videoWindow.SetWindowPosition(
pictureBox1.ClientRectangle.Left,
pictureBox1.ClientRectangle.Top,
pictureBox1.ClientRectangle.Width,
pictureBox1.ClientRectangle.Height);
}
catch
{
// An error can occur if the file does not have a video
// source (for example, an MP3 file.)
// You can ignore this error and still allow playback to
// continue (without any visualization).
}
mediapos = (IMediaPosition)graphManager;
imex = (IMediaEventEx)graphManager;
imex.SetNotifyWindow((int)this.Handle, WM_GRAPHNOTIFY, 0);
// Start the playback (asynchronously).
mc = (IMediaControl)graphManager;
mc.Run();
willem-jan
|
|
|
|
|
Check out the IVMRMonitorConfig interface.
Mark
Great job, team. Head back to base for debriefing and cocktails.
|
|
|
|
|
Please can you help me some more, i'm new to directx and i think i'm gettinig it a litle bit. On a wxp machine i'm not using the extended monitor option. Both monitors show the same app and picturebox of course. It seems strange to me that any picture, shown in the picturebox shows up in both the screens, but when rendering a video by direct x it won't show on the second screen. You answered me (thanx) to do something with the "IVMRMonitorConfig interface" bth where in the code should i do what to get there?
|
|
|
|
|
XP uses the Video Mixing Renderer 7 (VMR-7) filter for video rendering by default. You could
eumerate the filters in the graph and find the VMR-7 filter and obtain the IVMRMonitorConfig
interface from it.
I'm not sure how you'd do it on two monitors, both displaying the same. You have two separate
video adapters you said, right? Maybe in that case you'd need two renderers, both set to the
same window, but configured to display on different monitors.
If that doesn't work, then another (possibly simpler) solution is to implement your own video
renderer filter using GDI instead of DirectX for drawing. That will draw to both just as
picture's (bitmaps) do.
Great job, team. Head back to base for debriefing and cocktails.
|
|
|
|
|
|
I have the following task to perform but cant find a good solution.
The have to be able to play a number of small mpeg2 files in sequence without any sign of jumping from one to next. I need to be able play forward/backwards as well as fast forward and rewind modes. I have experimented using the Direct Show editing services, but this does not support VR8 or 9 so the performance is poor. I have also tried some SDK's from LeadTools and Elecard but these have limitations with no workaround.
Any advice as to the best way forward is much appreciated.
Coxy.
|
|
|
|
|
[previously posted on the VC board, no satisfactory answer there so I thought I would repost it on this new forum that may be better suited]
Hey all,
I am busy updating my CFileEditCtrl class[^] to support XP themes. As part of that update I want the browse button to be drawn the same as a combo box dropdown button, except without the arrow. Using DrawThemeBackground automatically draws the arrow.
HTHEME hTheme = OpenThemeData(*this, L"COMBOBOX");
LRESULT ret = DrawThemeBackground(hTheme, dc, CP_DROPDOWNBUTTON, CBXS_NORMAL, CRect(10, 10, 27, 27), NULL);
Is there any option that will draw the themed button background without the arrow?
I tried using the scroll bar's thumb as the background as it works fine in silver colour, but not in blue or green.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
I'd guess your problem is you're using the wrong theme data. Why draw a plain button using a combo box theme?
This article might be helpful: Color Picker for WTL with XP themes[^] - the code there draws a button with a dropdown arrow, I imagine you could use the same code, just leave out the arrow drawing.
|
|
|
|
|
Thanks for the hint, but that is not what I am after.
Michael Dunn wrote: Why draw a plain button using a combo box theme?
I do not want a plain button. In the default blue theme a plain button has a whitish background with a dark blue border and it shows hot by drawing a yellow box around the client area. A combo box button is different shades of blue depending on it's state. My control is supposed to have the look and feel of a combo box, but the button is supposed to bring up a dialog, not just drop down a list box. As such I want to be able to draw my own icon on the button instead of the arrow. ie I want to draw a disk for saving files, a folder for opening files, a book for opening the windows address book, a printer for selecting a printer, an eye dropper for picking colours, etc.
Maybe I am just picky, but there must be a way to draw a button using the same colours as a combobox button. I have no problem doing all the drawing in my own code, I just need to know which APIs I have to call to get the colours needed, how to draw the borders so it matches the current theme and all the fun stuff like that.
With a scroll bar thumb the thumb background and the grip are drawn seperately so it is possible to draw the thumb without a grip. I had thought I could use the thumb theme instead of the combo box button for what I want but unfortunately the borders are drawn differently so it just did not look right. If the combo box button had the same drawing principle as the scroll bar thumb and had seperate code for the background and the arrow I would be set, but it does not so I am screwed in my quest.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|