how to merge two images into one with asp.net - asp.net

I am working on an asp.net project. I am searching for a solution such that after a background image of a div is chosen. The user selects another image and coordinate. Then, this image will be merged on the background image with the defined coordinate.
Thanks in advance.

If you wish to combine two images,firstly you must upload them into server via ajax requests.
Read this article : combining images
After you combine them,let the user download the new one.
Also if you're looking for an editor to do so,I suggest to place them on html5 canvas.
Best Regards

Your post is quite general, but look in to System.Drawing and using an AJAX call to post both images (as well as the coordinates chosen) and then return the combined image which can then be displayed.
Without more specifics that's really all I can offer.

Related

Asp.net How to set position for link buttons on a map

I am creating a search page based on continents. And I need to let the user click(choose) a continent and based on this choice. I do backend logic.
What I tried is to set a world map as a background of a div. And on this map I put the linkbuttons that represent the continent (as attached).
The problem is when I resize the screen the linkbuttons go into wrong positions. So please help me to find a way to PIN the buttons (continent names) to the map when resize or open the page on different screens.
Thank you.
Here is a link to a youtube video that shows you how to use google maps API. This may make what you are doing a little easier. I recently used this to create a mobile tour app.
Google Maps API
Thanks for trying to help. I just solved the problem and likeed to share the solution.
I have solved this using map on the image. So I made the continents clickable on the image without putting any controls on the image.

Tool for creating preview images from equirectangular Panoramas

I am looking for a tool or library that will allow me to generate a preview image for an equirectangular panoramic image. I am using the pannellum library [https://pannellum.org] to present panoramas, which works great. What I'd like to add, however, is a way to generate lightweight preview images to display on initial page load. I would like to have a small sized preview image that does not look warped. Does such a tool/library/script exist?
Thank you!
Dave
Some people like to convert panoramas to cube maps, which is a lot easier to google.
I've been looking at https://github.com/denivip/panorama, or also at https://stackoverflow.com/a/43469036/2471983 if you want a pure JavaScript approach (check out that entire question page for lots of info). Both of these will by default create all six cube faces; you can either edit them or just throw out the five extra faces.
Once you have this unprojected image, you can resize it using whatever utility you like.

Inserting text below image on download

I have a collection of images that a client can download should they desire. However, the boss came to me with a requirement to try and add text at the bottom of image. Unfortunately due to space constraints on the server, I can't simply use Javascript to add the information to the bottom of the page when it is uploaded.
Ideally the format should two rows with two cells each. Any help on this would be appreciated.
I believe this is what you are looking for.
http://mvark.blogspot.com/2004/12/code-programmatically-add-text-to.html

Hide or insert image (logo) in pdf using iTextSharp

We print pdf provided by the company and merged it with data from our C# ASP.Net 3.5 Web application using iTextSharp. This works well but we have been asked to either print the form with or without the company logo depending on the user preference.
Should I use a pdf with the logo and hide it or use a pdf without the logo and add the logo to it?
I have found numerous way to add a logo to a pdf but nothing on hiding images. Because the logo could be having different size and be in a different location I would prefer to hide it when needed instead of adding it. Can we hide images from pdf without removing it? What would be easier?
Or should we just use 2 versions of each forms, one with the logo and another without?
UPDATE: In a nutshell I just want to have your opinion to what way would be best. Use a form without a logo and add it when needed or use a form with the logo and hide it when needed. Thanks
FINAL UPDATE: Some people gave good answer but I see no way to accept their answer. Can someone help me?
Because no one answered my question I selected one of the comment as "the" answer. Thanks mkl!
You can store data private to your application in PDFs, e.g. logo size and location in the case at hand (cf. this answer on PieceInfo structures). I would, therefore, recommend that you create the PDFs without the logo but store the size and location for a logo in such a PieceInfo dictionary. If adding a logo is required later-on, use that information to properly place the logo

How to render Html to image format? [duplicate]

I'm generating a coupon based on dynamic input and a cropped image, and I'm displaying the coupon using ntml and css right now, the problem is, printing this has become an issue because of how backgrounds disappear when printing and other problems, so I think the best solution would be to be able to generate an image based on the html, or set up some kind of template that takes in strings and an image, and generates an image using the image fed in as a background and puts the coupon information on top.
Is there anything that does this already?
This is for an ASP.NET 3.5 C# website!
Thanks in advance.
edit: It'd be great if the output could be based on the HTML input, as the coupon is designed by manipulating the DOM using jQuery and dragging stuff around, it all works fine, it's just when it comes to the printing (to paper) it has z-indexing issues.
What you can do is create an aspx page that changes the response type to be in the format you want and then put the image into the stream. I created a barcode generator that does a similar thing. Excluding all the formalities of generating the image, you'll Page_Load will look something like this:
Bitmap FinalBitmap = new Bitmap();
MemoryStream msStream = new MemoryStream();
strInputParameter == Request.Params("MagicParm").ToString()
// Magic code goes here to generate your bitmap image.
FinalBitmap.Save(msStream, ImageFormat.Png);
Response.Clear();
Response.ContentType = "image/png";
msStream.WriteTo(Response.OutputStream);
if ((FinalBitmap != null)) FinalBitmap.Dispose();
and that's it! Then all you have to do in your image is set the URL to be something like RenderImage.aspx?MagicParm=WooHoo or whatever you need. That way you can have it render whatever you want to specify.
You can render html to a bitmap using the WebBrowser control in either a winforms or console application.
An example of this can be found here: http://www.wincustomize.com/articles.aspx?aid=136426&c=1
The above example can be modified to run in ASP.Net by creating a new STAThread and performing an Application.Run on it to start a new message loop.
PHP/Ruby Alternative
If you have accessed this question and are actually looking for soething that will work without Windows, you can try the KHTML library: http://wiki.goatpr0n.de/projects/khtmld
The website has a ridiculous name I admit, but I can assure you it is genuine. Other related pages are: the sourceforge page http://khtml2png.sourceforge.net/
Try PDFSharp...it's not exactly a "take this HTML and make a PDF" but with a small amout of fiddling you can easily make a PDF out of the info you are using to make the HTML.
MARKUP ONLY ALTERNATE SOLUTION
Use SVG and XSLT to transform the html data into an image that can be rendered/saved/etc.
I'll admit that at first it was tedious getting this to work because of all of the coordinates, but well worth the effort once it is running.
There is a very powerful image creation library called GD which I often use with PHP.
I am led to believe there is a wrapper for this library that ASP programmers can use. Try this
Unless the "other problems" are pretty severe, couldn't you just instruct your users to turn on Background Images when printing?
In any case, I'd default to serving a PDF rather than an image, doubly so since it is intended for print.
Just set up your css properly, so that you have a css file targeted at the print medium. It is pretty easy to guarantee that the coupon will always be legible, without worrying about whether they have bg images on or not. Needlesly moving to an image doesn't make any sense, unless there is some reason you don't want it to be machine readable.
I haven't tried to myself, but you should be able to render HTML into an image by using the WebBrowser control and the DrawToBitmap() method inherited from the base Control class.
UPDATE: I tried this myself and there are some caveats. The WebBrowser control doesn't seem to render the web page until the control is show, so the WebBrowser needs to be in a Form and the Form must be shown for the HTML to be rendered and the DocumentCompleted event to be raised.

Resources