Hi all
Here is my problem
I want to create an image so i can pass it on an object to put it as
watermark in my pdf report
Here is what i have write so far
Dim objBitmap As System.Drawing. Bitmap
Dim objGraphics As System.Drawing. Graphics
Dim cstream As System.IO.Memor yStream
Dim c As System.Drawing. Image
objBitmap = New System.Drawing. Bitmap(width, height)
objGraphics = System.Drawing. Graphics.FromIm age(objBitmap)
Dim drawFont As New System.Drawing. Font("Arial", 32)
Dim drawBrush As New System.Drawing. SolidBrush(Syst em.Drawing.Colo r.Black)
' Create point for upper-left corner of drawing.
Dim x As Single = 0.0F
Dim y As Single = 0.0F
' Set format of string.
Dim drawFormat As New System.Drawing. StringFormat
drawFormat.Form atFlags = System.Drawing. StringFormatFla gs.DirectionVer tical
g.DrawString("I MAGE TEXT", drawFont, drawBrush, x, y, drawFormat)
objBitmap.save ("c:\temp\a.jpg ")
objBitmap.Save( cstream, System.Drawing. Imaging.ImageFo rmat.Jpeg)
c = System.Drawing. Image.FromStrea m(cstream)
c.Save("c:\temp \b.jpg")
Now if you look at the a.jpg and b.jpg the a.jpg contains an image that
writes the "IMAGE TEXT"
but b.jpg is totaly BLACK!!!!!
What i'm doing wrong??
Thank you for your time 2 3126
Hi,
Think you are draw the string off the visible area of the bitmap.
This should work.
Dim bm As New Bitmap(50, 50)
Dim g As Graphics = Graphics.FromIm age(bm)
g.Clear(Color.B lack)
g.TranslateTran sform(25, 25)
g.RotateTransfo rm(90)
g.DrawString("H i", Me.Font, Brushes.White, 0, 0)
Ken
--------------------------
"Programmer " <se*******@hotm ail.com> wrote in message
news:um******** ******@TK2MSFTN GP15.phx.gbl...
Hi all
Here is my problem
I want to create an image so i can pass it on an object to put it as
watermark in my pdf report
Here is what i have write so far
Dim objBitmap As System.Drawing. Bitmap
Dim objGraphics As System.Drawing. Graphics
Dim cstream As System.IO.Memor yStream
Dim c As System.Drawing. Image
objBitmap = New System.Drawing. Bitmap(width, height)
objGraphics = System.Drawing. Graphics.FromIm age(objBitmap)
Dim drawFont As New System.Drawing. Font("Arial", 32)
Dim drawBrush As New System.Drawing. SolidBrush(Syst em.Drawing.Colo r.Black)
' Create point for upper-left corner of drawing.
Dim x As Single = 0.0F
Dim y As Single = 0.0F
' Set format of string.
Dim drawFormat As New System.Drawing. StringFormat
drawFormat.Form atFlags = System.Drawing. StringFormatFla gs.DirectionVer tical
g.DrawString("I MAGE TEXT", drawFont, drawBrush, x, y, drawFormat)
objBitmap.save ("c:\temp\a.jpg ")
objBitmap.Save( cstream, System.Drawing. Imaging.ImageFo rmat.Jpeg)
c = System.Drawing. Image.FromStrea m(cstream)
c.Save("c:\temp \b.jpg")
Now if you look at the a.jpg and b.jpg the a.jpg contains an image that
writes the "IMAGE TEXT"
but b.jpg is totaly BLACK!!!!!
What i'm doing wrong??
Thank you for your time
No that's not it
If you run the code the image is draw in a visible area.
That's the reason Save both files phisicaly to see if it's ok
The Bitmap is created succesfully and it also saved succesfully.
But then i try to pass it on an image object the image.save is black.
If i save the bitmap in a file (let's say "c:\temp\bitmap .jpg")
and instead of calling Image.FromStrea m(cstream) i call
Image.FromFile( c:\temp\bitmap. jpg")
the image is loaded succesfully!!!! !! and the save method of the image
Object
creates exactly the same image. With the text in it!!!!!!!
Please notice that i want the image object to pass it on an other function
Thank you for your time
Please help me
"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:Oq******** ******@TK2MSFTN GP14.phx.gbl... Hi,
Think you are draw the string off the visible area of the bitmap. This should work. Dim bm As New Bitmap(50, 50)
Dim g As Graphics = Graphics.FromIm age(bm)
g.Clear(Color.B lack)
g.TranslateTran sform(25, 25)
g.RotateTransfo rm(90)
g.DrawString("H i", Me.Font, Brushes.White, 0, 0) Ken
--------------------------
"Programmer " <se*******@hotm ail.com> wrote in message news:um******** ******@TK2MSFTN GP15.phx.gbl... Hi all Here is my problem
I want to create an image so i can pass it on an object to put it as watermark in my pdf report
Here is what i have write so far
Dim objBitmap As System.Drawing. Bitmap
Dim objGraphics As System.Drawing. Graphics
Dim cstream As System.IO.Memor yStream
Dim c As System.Drawing. Image objBitmap = New System.Drawing. Bitmap(width, height)
objGraphics = System.Drawing. Graphics.FromIm age(objBitmap)
Dim drawFont As New System.Drawing. Font("Arial", 32)
Dim drawBrush As New System.Drawing. SolidBrush(Syst em.Drawing.Colo r.Black)
' Create point for upper-left corner of drawing.
Dim x As Single = 0.0F
Dim y As Single = 0.0F
' Set format of string.
Dim drawFormat As New System.Drawing. StringFormat
drawFormat.Form atFlags = System.Drawing. StringFormatFla gs.DirectionVer tical
g.DrawString("I MAGE TEXT", drawFont, drawBrush, x, y, drawFormat)
objBitmap.save ("c:\temp\a.jpg ")
objBitmap.Save( cstream, System.Drawing. Imaging.ImageFo rmat.Jpeg)
c = System.Drawing. Image.FromStrea m(cstream)
c.Save("c:\temp \b.jpg") Now if you look at the a.jpg and b.jpg the a.jpg contains an image that writes the "IMAGE TEXT"
but b.jpg is totaly BLACK!!!!! What i'm doing wrong??
Thank you for your time This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Steve Amey |
last post by:
Hi all
I have an ARGB value for a Colour (Eg. -65536. The value was retrieved by
using the Color.ToArgb method), is there any way that I can create a
System.Drawing.Image or a System.Drawing.Bitmap from that value?
Regards,
Steve
|
by: David W. Simmonds |
last post by:
I know that I can create an Image object by using a path like
C:\MyPictures\pic.jpg, but how can I create an Image object by using a path
like /MyPictures/pic.jpg where the path is relative to the site. For
instance, if the site is http://www.foobar.com, then /MyPictures/pic.jpg
would be fully qualified by http://www.foobar.com/MyPictures/pic.jpg.
Presumably there is a way to get the fully qualified path by giving the
relative path.
|
by: Mango |
last post by:
Hi there, I will be very happy if someone helps me. I need to create dynamic
image, and save the state between the postback. I mean I've got 5 buttons
and when I click on one of them, the image is creted with:
System.Web.UI.WebControls.Image Img1 = new
System.Web.UI.WebControls.Image();
Img1.ImageUrl = newPath;
Panel1.Controls.Add(Img1);
|
by: Programmer |
last post by:
Hi all
Here is my problem
I want to create an image so i can pass it on an object to put it as
watermark in my pdf report
Here is what i have write so far
Dim objBitmap As System.Drawing.Bitmap
|
by: John Daly |
last post by:
Does anyone know how to create an image (JPEG) from an HTTPResponse object? I
am working on system that has a map pop up from our GIS department. I want
create an image at runtime from this popup and display that image on the main
page instead of opening a new window. This image will be a memory stream
only, but will need to be kept from page to page, and printer if required.
Any help will be much appreciated. If anyone knows of any...
| |
by: barb |
last post by:
So that the world at large benefits from our efforts, here is one fully
documented way to use Windows Irfanview freeware to create thumbnail web
galleries (http://www.irfanview.com).
STEP 1: Start with original thumbnails & two empty sub directories
STEP 2: Create smaller versions of the originals for one sub directory
STEP 3: Create thumbnail version of the originals the other sub directory
STEP 4: Create an index.html pointing to the...
|
by: pedrito |
last post by:
I've got an app that downloads images off the internet using anywhere from
1-20 threads concurrently (though generally around 4 threads).
I have a preview page that shows the images as they're downloading. The
threads that do the downloading trigger an event every 32K (the size of the
chunks I receive), at which point the images are drawn in the Preview page.
To create the images, I create a memory stream from the data and then use...
|
by: sanghavi |
last post by:
how to create a set up project in vb.net..how to run an application on a different machine
|
by: =?Utf-8?B?UGV0ZXIgSw==?= |
last post by:
I am working with Visual Studio or alternately with Expression Web. I need
to create about 50 aspx pages with about 1200 thumbnali images, typically
arranged in three to four groups per page, having hyperlinks to the
corresponding full size images.
Can anybody point me to locations in MSDN or elsewhere giving the references
to attach, the commands & objects for creating or opening the pages and
possibly available classes?
I have done...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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: 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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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...
| |