Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
S

sarabjs

@sarabjs
About
Posts
43
Topics
12
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Change registry key in Vista
    S sarabjs

    Hi, We have a number of computers (>300), for which we need to change a particular registry setting. So I wrote a C# program that uses this code to do that: RegistryKey regkey = Registry.LocalMachine.OpenSubKey(KeyName, true); regkey.SetValue(KeyValue, 2); When I distribute the executable, it works perfectly for all XP machines. But the Vista machines (even while in user accounts with Admin access) throw an error: System.Security.SecurityException: Requested registry access is not allowed I've tried looking for solutions online but couldn't follow any. Anyone who can help me change a registry key value in Vista through C# code? Thanks, Sarab

    C# help csharp windows-admin security question

  • Submitting a form in the webBrowser control to the default Browser
    S sarabjs

    Hi, I'm loading a simple HTML form in a C# form using the WebBrowser control: webBrowser.Navigate("registration.htm"); The form has a Submit button, which when clicked should open the default Browser and POST this data to the form handler on a website. I've found suggestions to handle this form locally or in the WebBrowser control itself, but none that describe how to make sure that the Submit button (in HTML) can lead to the default browser to open. Any ideas? Thanks, Sarab

    C# csharp html tutorial question

  • Getting images from an RTF file
    S sarabjs

    Hi, Thanks to everyone for your ideas! I managed to get the images. Here's how: Images in RTF are as hexadecimal strings (as noted from the specifications). So all that needed to be done was: 1. Convert the hexadecimal to a byte array: http://www.koders.com/csharp/fid8BD422682325288B294A97714AC061D115F0307D.aspx[^]) 2. Then make an image out of this array: byte[] bData; // The byte array MemoryStream memStream = new MemoryStream(bData, 0, bData.Length); Image iMage = Image.FromStream(memStream); Et voila! Sarab

    C# csharp winforms help question

  • Getting images from an RTF file
    S sarabjs

    Hi Giorgi, Yes - that's the problem! I've found plenty of examples describing how to insert images into RTF but none on how to do the opposite! Am surprized no one else has had the need for this.. Hope someone else can help ... ? Sarab

    C# csharp winforms help question

  • Getting images from an RTF file
    S sarabjs

    Hi, I need to collect the images from an RTF file as image objects that I can work on individually. Any ideas? I tried loading the RTF file in the RTFTextBox in WinForms. The images show up correctly, but I still haven't figured out a way of accessing them directly. Hope someone can help. Thanks! Sarab

    C# csharp winforms help question

  • changing image resolution in C#.NET
    S sarabjs

    Any ideas where I could read more about better resizing methods, esp any designed for enlarging images ? Thanks!

    .NET (Core and Framework) csharp graphics help question

  • changing image resolution in C#.NET
    S sarabjs

    That was helpful... Thanks Guffa!

    .NET (Core and Framework) csharp graphics help question

  • changing image resolution in C#.NET
    S sarabjs

    I wish to convert a 96dpi image to a 300dpi image in .NET... Here's the code I currently use: // iMage is the original 96dpi image int iNht=(iMage.Height*300)/96; int iNwd=(iMage.Width*300)/96; Bitmap bMap=new Bitmap(iMage,iNwd,iNht); bMap.SetResolution(300,300); iMage=bMap; The code works fine, but there's one problem - the 300dpi image is of poor quality (appears kinda faded)... Time is of concern, so I'm avoiding needing to write my own resize method... But the poorer quality is also not acceptable!! :( Any ideas?? Thanks!!

    .NET (Core and Framework) csharp graphics help question

  • Is there a way to handle OutOfMemory exceptions?
    S sarabjs

    Thanks folks!! I appreciate everyone's help... Turns out, I didn't have to cross the Seven Seas: I managed to solve the issue by explicitly disposing (Image.Dispose()) some images I was creating during processing... I used to think that .NET automatically clears the memory being held by an image object once all references to it are removed - Guess that isn't the case... Learnt a lot from these discussions though - Thanks! -- modified at 16:03 Friday 3rd February, 2006

    .NET (Core and Framework) help tutorial question

  • Is there a way to handle OutOfMemory exceptions?
    S sarabjs

    Just tried this... I write each image to disk after it is created, dispose it and force the garbage collector after every 20 images... No success however; I keep the Windows Task Manager on during processing, and the page file size still continues to gradually increase till it hits the limit, and once again I get hit with OutofMemory exceptions, which only lead to more when handled... Interestingly however, the moment the control comes out of the routine - the page file size immediately drops back to normal...

    .NET (Core and Framework) help tutorial question

  • Is there a way to handle OutOfMemory exceptions?
    S sarabjs

    Hello, I am working on a project that requires me to generate long reports that can have 150 pages or more - Each of these pages are generated as an A4 image (~3500x2480pixels), which is then inserted into an ArrayList... The problem however is that I'm repeatedly getting OutOfMemory exceptions that I seem to be unable to get rid of despite extensively clearing all objects i'm not using (using the Image.Dispose() method for example) as well as forcing the garbage collector (GC.Collect()) every now and then... I'm constructing each of these images in the 1bpp pixel format that would mean that each of these images would be ~1MB on average... For 200 images, this (crudely) corresponds to a 200MB ArrayList.. I agree this is a size larger than many RAMs, but shouldn't my computer be able use the pagefile (my pagefile is set to 512MB)?? Any one has any ideas on how I can get rid of, or even handle, these OutOfMemory exceptions?? Thanks, Sarab

    .NET (Core and Framework) help tutorial question

  • imaging code; looking for optimization
    S sarabjs

    and using the foreach loop worked wonders! The execution time's safely within the acceptable range now :) Thanks !!!

    .NET (Core and Framework) csharp graphics algorithms data-structures performance

  • imaging code; looking for optimization
    S sarabjs

    hmm... not so confident in managed c++.. can't remove the if statement either! thanks anyways...

    .NET (Core and Framework) csharp graphics algorithms data-structures performance

  • imaging code; looking for optimization
    S sarabjs

    Hi folks, The following piece of C#.NET code creates an A4 size binary image by reading values from a two-dimensional byte array iPage[][]. Is there anyway I can further optimize the nested for loop inside the unsafe block? It is taking ~2.2s, and I'd love to bring it down further. Sarab. // page dimensions iwd=iPage.Length; iht=iPage[0].Length; // create new bitmap bMap=new Bitmap(iwd, iht, PixelFormat.Format24bppRgb); // create bitmap data bData=bMap.LockBits(new Rectangle (0,0,iwd,iht),ImageLockMode.WriteOnly,PixelFormat.Format24bppRgb); // get bitmap position Scan0 = bData.Scan0; iStride=bData.Stride; unsafe { // initialize pointer byte *p = (byte*)(void*)Scan0; int nOffset = iStride-iwd*3; for(int y=0;y

    .NET (Core and Framework) csharp graphics algorithms data-structures performance

  • drawing text on an image
    S sarabjs

    Understood the anti-aliasing part.. But didn't quite understand your first suggestion.. As for your second suggestion, I figure it doesn't solve the memory problem.. Guess will take a shot at attempting your third suggestion though... Thanks... Sarab

    .NET (Core and Framework) graphics question csharp

  • drawing text on an image
    S sarabjs

    Hello folks, I wish to write text on an Image in .NET I figure I can use the Graphics.drawString() method to do so, but it turns out that .NET would only allow me to write on images with non-indexed pixel formats. The format I'm now using is 1bppIndexed, which allows me to keep the size of these image objects limited. I do not wish to change these images to a non-indexed pixel format like 24bppRGB (even though that allows me to draw text on the image), 'cause here I'm only dealing with binary images, each around 3500pixels by 2480pixels. Since a format like 24bppRGB occupies much more space than what is required, I was hoping there would be a way to write on the 1bppIndexed images directly. Any ideas? Thanks...

    .NET (Core and Framework) graphics question csharp

  • Image Binarization
    S sarabjs

    :) Yea, it is just an array lookup...

    .NET (Core and Framework) graphics adobe question

  • Viewing TIFF files
    S sarabjs

    I'm not sure whether the TIFF files need to handled any differently. I believe you can directly instantiate an Image object using the FromFile() method and use it howsoever you desire.

    .NET (Core and Framework) csharp dotnet question

  • Image Binarization
    S sarabjs

    I have a 2-dimensional integer array of the same width and height of the image, each of whose elements is either 1 or 0. Condition A just checks whether the corresponding element in the array is a 1 or a 0, and sets the pixel accordingly There doesn't seem to be a major drop in the time taken by the overall routine though. Do you have any suggestions? Sarabjit.

    .NET (Core and Framework) graphics adobe question

  • Image Binarization
    S sarabjs

    Thanks Christian, I found a solution from: http://www.bobpowell.net/onebit.htm Here's what I did: // new bitmap Bitmap bm=new Bitmap(iwd, iht,PixelFormat.Format1bppIndexed); BitmapData bmdn=bm.LockBits(new Rectangle(0,0,bm.Width,bm.Height),ImageLockMode.ReadWrite,PixelFormat.Format1bppIndexed); // variables int iIndex; byte bP, bMask; for(int y=0;y>3); bP=Marshal.ReadByte(bmdn.Scan0,iIndex); bMask=(byte)(0x80>>(x&0x7)); if (ConditionA) bP|=bMask; else bP &=(byte)(bMask^0xff); Marshal.WriteByte(bmdn.Scan0,iIndex,bP); } } bm.UnlockBits(bmdn);

    .NET (Core and Framework) graphics adobe question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups