Draw Images on fly | | |
Hello friends,
I have developed an application using ASP.NET and SQL Server.
Ours is a garment factory. I need to design another module in my
application.
I want to generate images on fly based on users selection(body, sleeve
etc).
Until here no problem. Coz we have only 2 types of bodies and 3 types
of sleeves and 3 types of necks. I can design static images and save in
the system and call.
But I need to give selection of color to the user. Which color user has
selected, the image should display in that color.
Here I am strucked. So the solution is to generate images on fly as we
cant edit static images. Is there any other solution or any software
can edit the images at run time(especially color)?
Or can anyone suggest an idea?
Not ony in ASP.NET, any other also appreciated.
thanks in advance | | | | re: Draw Images on fly
You can use the System.Drawing namespace and draw an image in memory in an
ASPX page, and then write it to the Response.OutputStream. You have to use
the URL of the ASPX page as an image URL, and set the Response.ContentType
to "image/jpg" (or "image.gif", depending), and it will display in another
page as if it were an image.
--
HTH,
Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist
I recycle.
I send everything back to the planet it came from.
<mrajanikrishna@gmail.com> wrote in message
news:1150937884.743009.182260@g10g2000cwb.googlegr oups.com...[color=blue]
> Hello friends,
>
> I have developed an application using ASP.NET and SQL Server.
> Ours is a garment factory. I need to design another module in my
> application.
>
> I want to generate images on fly based on users selection(body, sleeve
> etc).
> Until here no problem. Coz we have only 2 types of bodies and 3 types
> of sleeves and 3 types of necks. I can design static images and save in
> the system and call.
>
> But I need to give selection of color to the user. Which color user has
> selected, the image should display in that color.
>
> Here I am strucked. So the solution is to generate images on fly as we
> cant edit static images. Is there any other solution or any software
> can edit the images at run time(especially color)?
>
> Or can anyone suggest an idea?
>
> Not ony in ASP.NET, any other also appreciated.
>
> thanks in advance
>[/color] | | | | re: Draw Images on fly
I would strongly consider making something like this in Flash, and assign
colors programmatically using Actionscript. You can do this with various
bitmap drawing things using other web technologies, but Flash will be
easier.
-KF
<mrajanikrishna@gmail.com> wrote in message
news:1150937884.743009.182260@g10g2000cwb.googlegr oups.com...[color=blue]
> Hello friends,
>
> I have developed an application using ASP.NET and SQL Server.
> Ours is a garment factory. I need to design another module in my
> application.
>
> I want to generate images on fly based on users selection(body, sleeve
> etc).
> Until here no problem. Coz we have only 2 types of bodies and 3 types
> of sleeves and 3 types of necks. I can design static images and save in
> the system and call.
>
> But I need to give selection of color to the user. Which color user has
> selected, the image should display in that color.
>
> Here I am strucked. So the solution is to generate images on fly as we
> cant edit static images. Is there any other solution or any software
> can edit the images at run time(especially color)?
>
> Or can anyone suggest an idea?
>
> Not ony in ASP.NET, any other also appreciated.
>
> thanks in advance
>[/color] | | | | re: Draw Images on fly
HI kevin:
I'm Chinese people,
yes, i have meet the extend problem
when i using Resoponse.OutStream to display a image in an ascx , and
the ascx be using in the man page.
but there a problem, when i click the button in the main page to drawing
the image in the ascx controls,
and display it,the image is shown but the main page's contenttype turn to
"image/jepg" and the button is can not find in the man page.
can you tell me ,what can let the ascx content-type not to changed the main
page contenttype.
my english is pool thanks.
if you need the source code i can pulish to you .
"Kevin Spencer" <uce@ftc.gov> 写入消息新闻:uQ2TnvZlGHA.4512@TK2MSFTNGP04.phx.gbl ...[color=blue]
> You can use the System.Drawing namespace and draw an image in memory in an
> ASPX page, and then write it to the Response.OutputStream. You have to use
> the URL of the ASPX page as an image URL, and set the Response.ContentType
> to "image/jpg" (or "image.gif", depending), and it will display in another
> page as if it were an image.
>
> --
> HTH,
>
> Kevin Spencer
> Microsoft MVP
> Professional Chicken Salad Alchemist
>
> I recycle.
> I send everything back to the planet it came from.
>
> <mrajanikrishna@gmail.com> wrote in message
> news:1150937884.743009.182260@g10g2000cwb.googlegr oups.com...[color=green]
>> Hello friends,
>>
>> I have developed an application using ASP.NET and SQL Server.
>> Ours is a garment factory. I need to design another module in my
>> application.
>>
>> I want to generate images on fly based on users selection(body, sleeve
>> etc).
>> Until here no problem. Coz we have only 2 types of bodies and 3 types
>> of sleeves and 3 types of necks. I can design static images and save in
>> the system and call.
>>
>> But I need to give selection of color to the user. Which color user has
>> selected, the image should display in that color.
>>
>> Here I am strucked. So the solution is to generate images on fly as we
>> cant edit static images. Is there any other solution or any software
>> can edit the images at run time(especially color)?
>>
>> Or can anyone suggest an idea?
>>
>> Not ony in ASP.NET, any other also appreciated.
>>
>> thanks in advance
>>[/color]
>
>[/color] | | | | re: Draw Images on fly
> HI kevin拢潞[color=blue]
> I'm Chinese people,
> yes, i have meet the extend problem
>
> when i using Resoponse.OutStream to display a image in an ascx , and
> the ascx be using in the man page.
>
> but there a problem, when i click the button in the main page to drawing
> the image in the ascx controls,
> and display it,the image is shown but the main page's contenttype turn to
> "image/jepg" and the button is can not find in the man page.
> can you tell me ,what can let the ascx content-type not to changed the main
> page contenttype.
> my english is pool thanks.
>
> if you need the source code i can pulish to you .
>[/color]
You can not draw the image in the same request as the rest of the page!
The page should output HTML that contains a tag like
<img src="theimage.aspx">
In the separate "theimage.aspx" you set the content-type ("image/jpeg")
and use Response.OutputStream or Response.BinaryWrite to write
the image.
The browser always uses a separate request to get the image, after it
has gotten the page HTML.
Hans Kesting | | | | re: Draw Images on fly
Thank you very much.
yes you give me a good idea,i think i can come true the project target .
thank you.
"Hans Kesting" <news.2.hansdk@spamgourmet.com> 写入消息新闻:mn.b2407d66cf3ad1f2.43821@spamgourmet .com...[color=blue][color=green]
>> HI kevin£o
>> I'm Chinese people,
>> yes, i have meet the extend problem
>>
>> when i using Resoponse.OutStream to display a image in an ascx , and
>> the ascx be using in the man page.
>>
>> but there a problem, when i click the button in the main page to
>> drawing the image in the ascx controls,
>> and display it,the image is shown but the main page's contenttype turn to
>> "image/jepg" and the button is can not find in the man page.
>> can you tell me ,what can let the ascx content-type not to changed the
>> main page contenttype.
>> my english is pool thanks.
>>
>> if you need the source code i can pulish to you .
>>[/color]
>
> You can not draw the image in the same request as the rest of the page!
> The page should output HTML that contains a tag like
> <img src="theimage.aspx">
> In the separate "theimage.aspx" you set the content-type ("image/jpeg")
> and use Response.OutputStream or Response.BinaryWrite to write
> the image.
> The browser always uses a separate request to get the image, after it has
> gotten the page HTML.
>
> Hans Kesting
>
>[/color] | | | | re: Draw Images on fly
Hello,
Thanx for the reply. I used system.drawing namespace. I got
everything what I expected but how can I mirror the generated image.
Because, i have designed half of the shirt (right side). The mirror is
the left side. If I use bitmap.rotateFlip(rotate180flipx), actual image
is getting rotated. I want to duplicate the actual image and rotate it
and display as complete image. I think you got what I mean.
How can I do this.
My bitmap area is (200,200). I generated the image from the
middle(100,0)
Please reply me.
Kevin Spencer wrote:[color=blue]
> You can use the System.Drawing namespace and draw an image in memory in an
> ASPX page, and then write it to the Response.OutputStream. You have to use
> the URL of the ASPX page as an image URL, and set the Response.ContentType
> to "image/jpg" (or "image.gif", depending), and it will display in another
> page as if it were an image.
>
> --
> HTH,
>
> Kevin Spencer
> Microsoft MVP
> Professional Chicken Salad Alchemist
>
> I recycle.
> I send everything back to the planet it came from.
>
> <mrajanikrishna@gmail.com> wrote in message
> news:1150937884.743009.182260@g10g2000cwb.googlegr oups.com...[color=green]
> > Hello friends,
> >
> > I have developed an application using ASP.NET and SQL Server.
> > Ours is a garment factory. I need to design another module in my
> > application.
> >
> > I want to generate images on fly based on users selection(body, sleeve
> > etc).
> > Until here no problem. Coz we have only 2 types of bodies and 3 types
> > of sleeves and 3 types of necks. I can design static images and save in
> > the system and call.
> >
> > But I need to give selection of color to the user. Which color user has
> > selected, the image should display in that color.
> >
> > Here I am strucked. So the solution is to generate images on fly as we
> > cant edit static images. Is there any other solution or any software
> > can edit the images at run time(especially color)?
> >
> > Or can anyone suggest an idea?
> >
> > Not ony in ASP.NET, any other also appreciated.
> >
> > thanks in advance
> >[/color][/color] | | | | re: Draw Images on fly
I'm sure your english is better than my Chinese! :)
I am not sure what all of the problems are with your solution, but I do know
of at least one, and if we eliminate them one by one we can straighten
everything out. The biggest problem is that you are attempting to insert an
image directly into a page.
An HTML document is pure text. There is no binary content in it, no images,
no Flash, no sound. These are referenced in the HTML document with tags that
contain the URL of the resource to be displayed in the browser. If you look
at the source code of any HTML page in your browser you will see this.
ASP.Net is simply a technology that, for the most part, creates HTML pages
from server-side programming. It has some other related capabilities as
well, such as the ability to send binary data from the server in an HTTP
stream.
Now, my original message said to use an ASPX page, *not* an ASCX UserControl
in a page. The reason is that there has to be a resource that can be
referenced in the HTML of another page which will send the image to the
client browser when requested. When you set the Response.ContentType to
"image/jpg" you are setting the ContentType header for the *entire*
response, which tells the browser that "xyz.aspx" is not an ASPX page, but
an image. This is *all* that the "image" ASPX page should do. Set the
Response.ContentType to "image/jpg" and write the binary image to the
Response.OutputStream. In *another* ASPX page, or even an HTML page, an HTML
image tag can be used to reference the "image" ASPX page as an image, such
as:
<img src="imageMaker.aspx" />
--
HTH,
Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist
I recycle.
I send everything back to the planet it came from.
"Yankee.zhang" <yanmaha@163.com> wrote in message
news:uYEYadclGHA.2128@TK2MSFTNGP04.phx.gbl...[color=blue]
> HI kevin:
> I'm Chinese people,
> yes, i have meet the extend problem
>
> when i using Resoponse.OutStream to display a image in an ascx , and
> the ascx be using in the man page.
>
> but there a problem, when i click the button in the main page to
> drawing the image in the ascx controls,
> and display it,the image is shown but the main page's contenttype turn to
> "image/jepg" and the button is can not find in the man page.
> can you tell me ,what can let the ascx content-type not to changed the
> main page contenttype.
> my english is pool thanks.
>
> if you need the source code i can pulish to you .
>
>
> "Kevin Spencer" <uce@ftc.gov>
> 写入消息新闻:uQ2TnvZlGHA.4512@TK2MSFTNGP04.phx.gbl ...[color=green]
>> You can use the System.Drawing namespace and draw an image in memory in
>> an ASPX page, and then write it to the Response.OutputStream. You have to
>> use the URL of the ASPX page as an image URL, and set the
>> Response.ContentType to "image/jpg" (or "image.gif", depending), and it
>> will display in another page as if it were an image.
>>
>> --
>> HTH,
>>
>> Kevin Spencer
>> Microsoft MVP
>> Professional Chicken Salad Alchemist
>>
>> I recycle.
>> I send everything back to the planet it came from.
>>
>> <mrajanikrishna@gmail.com> wrote in message
>> news:1150937884.743009.182260@g10g2000cwb.googlegr oups.com...[color=darkred]
>>> Hello friends,
>>>
>>> I have developed an application using ASP.NET and SQL Server.
>>> Ours is a garment factory. I need to design another module in my
>>> application.
>>>
>>> I want to generate images on fly based on users selection(body, sleeve
>>> etc).
>>> Until here no problem. Coz we have only 2 types of bodies and 3 types
>>> of sleeves and 3 types of necks. I can design static images and save in
>>> the system and call.
>>>
>>> But I need to give selection of color to the user. Which color user has
>>> selected, the image should display in that color.
>>>
>>> Here I am strucked. So the solution is to generate images on fly as we
>>> cant edit static images. Is there any other solution or any software
>>> can edit the images at run time(especially color)?
>>>
>>> Or can anyone suggest an idea?
>>>
>>> Not ony in ASP.NET, any other also appreciated.
>>>
>>> thanks in advance
>>>[/color]
>>
>>[/color]
>
>[/color] | | | | re: Draw Images on fly
Copy the image to a new in-memory image, and flip the new image, then draw
it into the blank portion of the first image. :)
--
HTH,
Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist
I recycle.
I send everything back to the planet it came from.
<mrajanikrishna@gmail.com> wrote in message
news:1150966434.111069.312910@g10g2000cwb.googlegr oups.com...[color=blue]
> Hello,
>
> Thanx for the reply. I used system.drawing namespace. I got
> everything what I expected but how can I mirror the generated image.
>
> Because, i have designed half of the shirt (right side). The mirror is
> the left side. If I use bitmap.rotateFlip(rotate180flipx), actual image
> is getting rotated. I want to duplicate the actual image and rotate it
> and display as complete image. I think you got what I mean.
>
> How can I do this.
>
> My bitmap area is (200,200). I generated the image from the
> middle(100,0)
>
> Please reply me.
>
>
>
> Kevin Spencer wrote:[color=green]
>> You can use the System.Drawing namespace and draw an image in memory in
>> an
>> ASPX page, and then write it to the Response.OutputStream. You have to
>> use
>> the URL of the ASPX page as an image URL, and set the
>> Response.ContentType
>> to "image/jpg" (or "image.gif", depending), and it will display in
>> another
>> page as if it were an image.
>>
>> --
>> HTH,
>>
>> Kevin Spencer
>> Microsoft MVP
>> Professional Chicken Salad Alchemist
>>
>> I recycle.
>> I send everything back to the planet it came from.
>>
>> <mrajanikrishna@gmail.com> wrote in message
>> news:1150937884.743009.182260@g10g2000cwb.googlegr oups.com...[color=darkred]
>> > Hello friends,
>> >
>> > I have developed an application using ASP.NET and SQL Server.
>> > Ours is a garment factory. I need to design another module in my
>> > application.
>> >
>> > I want to generate images on fly based on users selection(body, sleeve
>> > etc).
>> > Until here no problem. Coz we have only 2 types of bodies and 3 types
>> > of sleeves and 3 types of necks. I can design static images and save in
>> > the system and call.
>> >
>> > But I need to give selection of color to the user. Which color user has
>> > selected, the image should display in that color.
>> >
>> > Here I am strucked. So the solution is to generate images on fly as we
>> > cant edit static images. Is there any other solution or any software
>> > can edit the images at run time(especially color)?
>> >
>> > Or can anyone suggest an idea?
>> >
>> > Not ony in ASP.NET, any other also appreciated.
>> >
>> > thanks in advance
>> >[/color][/color]
>[/color] | | | | re: Draw Images on fly
Hi Kevin,
At first thanks for your sense of humor reply.
yes, yours suggestion be using in my projects.
the aim of using ascx is i went to create a control to drawing the
image by customize datasource.
if you have any good idea for build the darw image control,please tech
me,thanks.
"Kevin Spencer" <uce@ftc.gov> 写入消息新闻:uh2I5TelGHA.3396@TK2MSFTNGP05.phx.gbl ...[color=blue]
> I'm sure your english is better than my Chinese! :)
>
> I am not sure what all of the problems are with your solution, but I do
> know of at least one, and if we eliminate them one by one we can
> straighten everything out. The biggest problem is that you are attempting
> to insert an image directly into a page.
>
> An HTML document is pure text. There is no binary content in it, no
> images, no Flash, no sound. These are referenced in the HTML document with
> tags that contain the URL of the resource to be displayed in the browser.
> If you look at the source code of any HTML page in your browser you will
> see this. ASP.Net is simply a technology that, for the most part, creates
> HTML pages from server-side programming. It has some other related
> capabilities as well, such as the ability to send binary data from the
> server in an HTTP stream.
>
> Now, my original message said to use an ASPX page, *not* an ASCX
> UserControl in a page. The reason is that there has to be a resource that
> can be referenced in the HTML of another page which will send the image to
> the client browser when requested. When you set the Response.ContentType
> to "image/jpg" you are setting the ContentType header for the *entire*
> response, which tells the browser that "xyz.aspx" is not an ASPX page, but
> an image. This is *all* that the "image" ASPX page should do. Set the
> Response.ContentType to "image/jpg" and write the binary image to the
> Response.OutputStream. In *another* ASPX page, or even an HTML page, an
> HTML image tag can be used to reference the "image" ASPX page as an image,
> such as:
>
> <img src="imageMaker.aspx" />
>
> --
> HTH,
>
> Kevin Spencer
> Microsoft MVP
> Professional Chicken Salad Alchemist
>
> I recycle.
> I send everything back to the planet it came from.
>
> "Yankee.zhang" <yanmaha@163.com> wrote in message
> news:uYEYadclGHA.2128@TK2MSFTNGP04.phx.gbl...[color=green]
>> HI kevin:
>> I'm Chinese people,
>> yes, i have meet the extend problem
>>
>> when i using Resoponse.OutStream to display a image in an ascx , and
>> the ascx be using in the man page.
>>
>> but there a problem, when i click the button in the main page to
>> drawing the image in the ascx controls,
>> and display it,the image is shown but the main page's contenttype turn to
>> "image/jepg" and the button is can not find in the man page.
>> can you tell me ,what can let the ascx content-type not to changed the
>> main page contenttype.
>> my english is pool thanks.
>>
>> if you need the source code i can pulish to you .
>>
>>
>> "Kevin Spencer" <uce@ftc.gov> 写入消息新闻:uQ2TnvZlGHA.4512@TK2MSFTNGP04.phx.gbl ...[color=darkred]
>>> You can use the System.Drawing namespace and draw an image in memory in
>>> an ASPX page, and then write it to the Response.OutputStream. You have
>>> to use the URL of the ASPX page as an image URL, and set the
>>> Response.ContentType to "image/jpg" (or "image.gif", depending), and it
>>> will display in another page as if it were an image.
>>>
>>> --
>>> HTH,
>>>
>>> Kevin Spencer
>>> Microsoft MVP
>>> Professional Chicken Salad Alchemist
>>>
>>> I recycle.
>>> I send everything back to the planet it came from.
>>>
>>> <mrajanikrishna@gmail.com> wrote in message
>>> news:1150937884.743009.182260@g10g2000cwb.googlegr oups.com...
>>>> Hello friends,
>>>>
>>>> I have developed an application using ASP.NET and SQL Server.
>>>> Ours is a garment factory. I need to design another module in my
>>>> application.
>>>>
>>>> I want to generate images on fly based on users selection(body, sleeve
>>>> etc).
>>>> Until here no problem. Coz we have only 2 types of bodies and 3 types
>>>> of sleeves and 3 types of necks. I can design static images and save in
>>>> the system and call.
>>>>
>>>> But I need to give selection of color to the user. Which color user has
>>>> selected, the image should display in that color.
>>>>
>>>> Here I am strucked. So the solution is to generate images on fly as we
>>>> cant edit static images. Is there any other solution or any software
>>>> can edit the images at run time(especially color)?
>>>>
>>>> Or can anyone suggest an idea?
>>>>
>>>> Not ony in ASP.NET, any other also appreciated.
>>>>
>>>> thanks in advance
>>>>
>>>
>>>[/color]
>>
>>[/color]
>
>[/color] | | | | re: Draw Images on fly
Hi,
Thanx for the reply. Can you pls suggest me how to copy an image
in-memry? I used oBmp.clone() but i cant get success.
thanx
Kevin Spencer wrote:[color=blue]
> Copy the image to a new in-memory image, and flip the new image, then draw
> it into the blank portion of the first image. :)
>
> --
> HTH,
>
> Kevin Spencer
> Microsoft MVP
> Professional Chicken Salad Alchemist
>
> I recycle.
> I send everything back to the planet it came from.
>
> <mrajanikrishna@gmail.com> wrote in message
> news:1150966434.111069.312910@g10g2000cwb.googlegr oups.com...[color=green]
> > Hello,
> >
> > Thanx for the reply. I used system.drawing namespace. I got
> > everything what I expected but how can I mirror the generated image.
> >
> > Because, i have designed half of the shirt (right side). The mirror is
> > the left side. If I use bitmap.rotateFlip(rotate180flipx), actual image
> > is getting rotated. I want to duplicate the actual image and rotate it
> > and display as complete image. I think you got what I mean.
> >
> > How can I do this.
> >
> > My bitmap area is (200,200). I generated the image from the
> > middle(100,0)
> >
> > Please reply me.
> >
> >
> >
> > Kevin Spencer wrote:[color=darkred]
> >> You can use the System.Drawing namespace and draw an image in memory in
> >> an
> >> ASPX page, and then write it to the Response.OutputStream. You have to
> >> use
> >> the URL of the ASPX page as an image URL, and set the
> >> Response.ContentType
> >> to "image/jpg" (or "image.gif", depending), and it will display in
> >> another
> >> page as if it were an image.
> >>
> >> --
> >> HTH,
> >>
> >> Kevin Spencer
> >> Microsoft MVP
> >> Professional Chicken Salad Alchemist
> >>
> >> I recycle.
> >> I send everything back to the planet it came from.
> >>
> >> <mrajanikrishna@gmail.com> wrote in message
> >> news:1150937884.743009.182260@g10g2000cwb.googlegr oups.com...
> >> > Hello friends,
> >> >
> >> > I have developed an application using ASP.NET and SQL Server.
> >> > Ours is a garment factory. I need to design another module in my
> >> > application.
> >> >
> >> > I want to generate images on fly based on users selection(body, sleeve
> >> > etc).
> >> > Until here no problem. Coz we have only 2 types of bodies and 3 types
> >> > of sleeves and 3 types of necks. I can design static images and save in
> >> > the system and call.
> >> >
> >> > But I need to give selection of color to the user. Which color user has
> >> > selected, the image should display in that color.
> >> >
> >> > Here I am strucked. So the solution is to generate images on fly as we
> >> > cant edit static images. Is there any other solution or any software
> >> > can edit the images at run time(especially color)?
> >> >
> >> > Or can anyone suggest an idea?
> >> >
> >> > Not ony in ASP.NET, any other also appreciated.
> >> >
> >> > thanks in advance
> >> >[/color]
> >[/color][/color] |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,510 network members.
|