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

Image Modofication

Hi everyone,

I would like to implement the following functionality

Program to read image file, add a layer on top (partially transparent), then
save the images with these changes

How can that be achieved?

Thank you,
Samuel
Jan 1 '07 #1
6 853
See if this helps...
http://articles.techrepublic.com.com...1-6118091.html
"Samuel Shulman" <sa************@ntlworld.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hi everyone,

I would like to implement the following functionality

Program to read image file, add a layer on top (partially transparent),
then save the images with these changes

How can that be achieved?

Thank you,
Samuel

Jan 1 '07 #2
"Samuel Shulman" <sa************@ntlworld.comschrieb:
Program to read image file, add a layer on top (partially transparent),
then save the images with these changes

How can that be achieved?
Check out the 'System.Drawing.Bitmap' class.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Jan 1 '07 #3
Addendum:

I forgot to mention the 'Graphics' class, which can be used to draw another
bitmap onto your bitmap using its 'DrawImage' method. A 'Graphics' object
for a bitmap can be obtained using 'Graphics.FromImage'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Jan 1 '07 #4
This is the code

Note that the original image can't be used!

Thanks,
Samuel
Public Shared Sub AddTextToImage(ByVal sImageFilePath As String)

Dim org As Bitmap = Image.FromFile(sImageFilePath)

Dim bm As Bitmap = New Bitmap(org.Width, org.Height) ') '; << Can specify
optional pixel format but defaults to 32bppArgb

Dim g As Graphics = Graphics.FromImage(bm)

g.DrawImage(org, 0, 0, org.Width, org.Height)

Dim objFont As System.Drawing.Font

g.TextRenderingHint = TextRenderingHint.AntiAlias

'//Draw other stuff on g here...

objFont = New Font("Comic Sans MS", 75, FontStyle.Bold)

' Write out the text

g.DrawString("Sold", objFont, Brushes.CornflowerBlue, 28, 100)

org.Dispose()

g.Dispose()

'delete the previous file

IO.File.Delete(sImageFilePath)

bm.Save(sImageFilePath, Imaging.ImageFormat.Jpeg)

bm.Dispose()

End Sub
"Herfried K. Wagner [MVP]" <hi***************@gmx.atwrote in message
news:u4**************@TK2MSFTNGP03.phx.gbl...
Addendum:

I forgot to mention the 'Graphics' class, which can be used to draw
another bitmap onto your bitmap using its 'DrawImage' method. A
'Graphics' object for a bitmap can be obtained using 'Graphics.FromImage'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Jan 2 '07 #5
Samuel,

"Samuel Shulman" <sa************@ntlworld.comschrieb:
This is the code

Note that the original image can't be used!
Did this code solve the problem?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Jan 2 '07 #6
Yes,

"Herfried K. Wagner [MVP]" <hi***************@gmx.atwrote in message
news:Oy*************@TK2MSFTNGP06.phx.gbl...
Samuel,

"Samuel Shulman" <sa************@ntlworld.comschrieb:
>This is the code

Note that the original image can't be used!

Did this code solve the problem?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Jan 3 '07 #7

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

Similar topics

9
by: Pierre Tremblay | last post by:
Hi! I am trying to display an image in my html document. The document contains the following line: <td class="Input"><img...
3
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a...
2
by: Tjerk | last post by:
Hello all, I have the script below to change an image depending on the date upto january it worked fine but then it just stopped working does anybody have an idea how I can make it work again or...
8
by: Jef Driesen | last post by:
I'm implementing some image processing algorithms in C++. I created a class called 'image' (see declaration below), that will take care of the memory allocations and some basic (mathematical)...
6
by: QuasiChameleon | last post by:
Hi, I'm trying to create a grayscale image class that reads and writes grayscale Targa format. This works well with smaller images, but corrupts larger images and creates a "Segmentation fault...
15
by: Anand Ganesh | last post by:
HI All, I have an Image. I want to clip a portion of it and copy to another image. How to do this? I know the bounding rectangle to clip. Any suggestions please. Thanks for your time and...
7
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard...
15
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
0
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...
0
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...
0
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,...

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.