c# - Asp.net mvc 4 merging two images -
i have view showing list of images in slider every thing done in want code when user select 2 images controller should merge images each other , implement text on both images.well possible in jquery copy both divs , convert them image , send controller well.
any example c# jquery please let me know
[httppost] public actionresult index(httppostedfilebase imageone, httppostedfilebase imagetwo) { return view(); } public static system.io.memorystream combineimages(byte[] imagebytes1, byte[] imagebytes2) { if ((imagebytes1 == null || imagebytes1.length == 0) || (imagebytes2 == null || imagebytes2.length == 0)) return null; //convert bytes image var image1 = system.drawing.image.fromstream(new system.io.memorystream(imagebytes1)); var image2 = system.drawing.image.fromstream(new system.io.memorystream(imagebytes2)); //create bitmap object var bitmap = new system.drawing.bitmap(image1.width, image1.height, pixelformat.format32bpppargb); //create graphics object var g = system.drawing.graphics.fromimage(bitmap); g.smoothingmode = system.drawing.drawing2d.smoothingmode.highquality; g.interpolationmode = system.drawing.drawing2d.interpolationmode.high; g.pixeloffsetmode = system.drawing.drawing2d.pixeloffsetmode.highquality; g.drawimage(image1, 0, 0); g.drawimage(image2, 0, 0); var ms = new system.io.memorystream(bitmap.width * bitmap.height); bitmap.save(ms, system.drawing.imaging.imageformat.png); return ms; }
you wouldn't have copy both divs, assuming images have on page on server ask user 2 images , upload file paths json , retrieve them folder in controller , go there.
Comments
Post a Comment