I am taking a 256 color bitmap from a file
and scaling it up X 16 to a 32bppPARGB bitmap
in memory. I copy that image to the screen.
After scaling, the edges of all the lines and
colors are blurred. I want the edges all
crisp, including inherent pixelation (jaggies).
Setting smoothing to none, or adjusting the
composting mode on the Graphics object still
yields blurred edges. What do I need to do
to the scale up the image, pixel for pixel?
The bitmaps are created like:
Maps = DirectCast(Bitm ap.FromFile(".. \images\maps.bm p"), Bitmap)
LargeMap = New Bitmap(MapSize. Width * 16 + 4, MapSize.Height * 16 + 4, Imaging.PixelFo rmat.Format32bp pPArgb)
Then later;
Dim grx As Graphics = Graphics.FromIm age(LargeMap)
grx.Clear(Color .DarkGreen)
grx.SmoothingMo de = Drawing2D.Smoot hingMode.None
grx.Compositing Mode = Drawing2D.Compo sitingMode.Sour ceCopy
grx.DrawImage(M aps, New Rectangle(0, 0, MapSize.Width * 16, MapSize.Height * 16), _
New Rectangle(0, Index * MapSize.Height, MapSize.Width, MapSize.Height) , _
GraphicsUnit.Pi xel)
The image should be scaled there, and is later copied to the screen:
Dim grx As Graphics = Me.CreateGraphi cs
grx.SmoothingMo de = Drawing2D.Smoot hingMode.None
grx.DrawImage(L argeMap, New Rectangle(10, 40, 400, 400), New Rectangle(80, 80, 400, 400), GraphicsUnit.Pi xel)
What I see on the screen is blurred, but I suspect I need to address the
problem during the scaling process.
Any/all help will be appreciated....
LFS 3 2558
"Larry Serflaten" <se*******@usin ternet.com> wrote
I found it! It was the Nearest-Neighbor interpolation mode I needed.... Setting smoothing to none, or adjusting the composting mode on the Graphics object still yields blurred edges. What do I need to do to the scale up the image, pixel for pixel?
grx.Clear(Color .DarkGreen) grx.SmoothingMo de = Drawing2D.Smoot hingMode.None
grx.Interpolati onMode = Drawing2D.Inter polationMode.Ne arestNeighbor grx.DrawImage(M aps, New Rectangle(0, 0, MapSize.Width * 16, MapSize.Height * 16), _ New Rectangle(0, Index * MapSize.Height, MapSize.Width, MapSize.Height) , _ GraphicsUnit.Pi xel)
Larry,
"Larry Serflaten" <se*******@usin ternet.com> schrieb: Dim grx As Graphics = Me.CreateGraphi cs
grx.SmoothingMo de = Drawing2D.Smoot hingMode.None grx.DrawImage(L argeMap, New Rectangle(10, 40, 400, 400), New Rectangle(80, 80, 400, 400), GraphicsUnit.Pi xel)
Just to make sure you don't forget to do that: The 'Graphics' objects in
the snippets you provided "should" be disposed...
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote grx.SmoothingMo de = Drawing2D.Smoot hingMode.None grx.DrawImage(L argeMap, New Rectangle(10, 40, 400, 400), New Rectangle(80, 80, 400, 400), GraphicsUnit.Pi xel)
Just to make sure you don't forget to do that: The 'Graphics' objects in the snippets you provided "should" be disposed...
Thanks for the reminder. Those were 'snippets' and not full examples of
working code. I still had other uses for that object that were not pertinant
to the discussion, and that code did not get included...
;-)
LFS This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Phil Powell |
last post by:
$mogResponse = exec("mogrify -size ${width}x$height " .
$this->locationPath . '/' . $this->fileName . '
-resize ' .
$width . "x$height > +profile " .
$this->thumbLocationPath . '/' . $this->fileName
.. ' 2>&1');
This attempt at creating a thumbnail only causes the original image to
be resized while creating a "ghost image" in the /thumb folder where
|
by: D. Alvarado |
last post by:
Hello,
Can anyone recommend a good image scaling program for PHP 4. What
I'm really looking for is just a function that takes an image file and
a width to which to scale the image and outputs the scaled image.
I am grateful for anyone's recommendations, - Dave
|
by: Stephane D'Alu |
last post by:
Do you know if it is possible to have an image to be scalled
to a maximum width/height, but with keeping its aspect ratio.
The two ideas I had were:
- <img src="toto.jpg" style="max-width: 200px; max-height: 200px;"/>
but it doesn't keep the ratio
- <div style="width: 200px; height: 200px;"><img src="toto.jpg/></div>
but the image flow outside the div
|
by: Harry Putnam |
last post by:
I keep stumbling around with varius alignment tags, even using STYLE
tag with absolute positioning but not getting a simple job done.
I have an arrangment like this:
____________________________________________
| |
| Large headline that is really an image |
| of Elaborate text created in photoshop. |
| This is presente in terms of % of page so |
|
by: =?Utf-8?B?SlIx?= |
last post by:
I would like to add text to an image. I have tried to use DrawString and it
works on some images but on others it is very very small. I am pretty sure
it has something to do with the size of the image but I have had varying
results on multiple images.
Is there anyway to make the text a fixed size on the image. Similar to
putting a date on a photograph.
| |
by: Yofnik |
last post by:
Hello all,
I need your help. Internet Explorer 6+ has a registry setting (UseHR)
that will automatically scale images for displays with high resolution
(DPI).
I am building a web based monitoring application that has some very
detailed graphs and charts. I DO NOT want these images scaled under any
circumstances. In fact, my graphs look better on high DPI screens when
the are not scaled.
|
by: Stephan Bourdon |
last post by:
Hi,
Your opinion please on the following subject: Is it acceptable to set
the width and height of an image in ems or percents in CSS?
The advantage for me is that images will scale up or down when the user
changes the font size in the browser. But what of the disadvantages?
In (X)HTML, the img-element will have a pixel-value for the width and
height-attributes.
|
by: Amir Michail |
last post by:
Hi,
The following gradient method involves scaling a gradient image. How
would one put a logo on top of such a scaled gradient image without
also scaling the logo image?
http://www.alistapart.com/articles/supereasyblendys
http://www.alistapart.com/d/supereasyblendys/examples/eg7.html
Amir
|
by: Peter May |
last post by:
Hi.
I know the dimensions area visible on the screen and I would like to
picture that there put dynamically, match its size to the window, while
retaining the proportions of course.
For example:
Screen area visible: 1280x589
The picture size: 3008x2000
|
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,...
|
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...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |