image-conversion

C++ gdi::Bitmap to PNG Image in memory

爱⌒轻易说出口 提交于 2019-12-01 09:22:18
问题 I'm trying to send a screenshot of a window over tcp to a server. Getting the screenshot is no problem (using GDIplus). The networking is also easy for me. The problem is trying to convert the gdi+ Bitmap to a png (in memory) to get the data out of it and send it to the server. Can anyone help me please? 回答1: Gdiplus can save to file, or save to memory using IStream . See Gdiplus::Image::Save method //get gdi+ bitmap Gdiplus::Bitmap bitmap(hbitmap, nullptr); //write to IStream IStream*

Conversion PDF to PNG or JPEG is very very slow using ImageMagick

你。 提交于 2019-11-30 10:49:27
I have a working PDF to PNG conversion script using PHP and ImageMagick but I am having a problem with the speed of the conversion. I know it works because with a very small PDF the time taken to convert is not that great, but with a 250kb file (still not that large really) it takes in excess of 20 minutes to convert. Here's the PHP: //***** GET PATH TO IMAGEMAGICK ***** $path_to_imagemagick = trim(`which convert`); //***** PATH TO PDF TO CONVERT ***** $path_to_pdf = getcwd() . "/pdf/myfile.pdf[0]"; //***** PATH TO OUTPUT TO ***** $output_path = getcwd() . "/pdfimage/test_converted.png"; @exec

rgb to ycbcr conversion in matlab

假如想象 提交于 2019-11-30 07:52:34
问题 I am trying to write a function in Matlab that takes an RGB image of class unit8 and double and converts it to a YCBCR image. The transformation formula is below. I would be really thankful for any help of any kind. 回答1: There's an Image Processing Toolbox function for that, if you have access to it: RGB2YCBCR If you don't have access to it, here's how you can do the conversion yourself: rgbImage = imread('peppers.png'); %# A sample RGB image A = [65.481 -37.797 112; ... %# A 3-by-3 matrix of

convert image to base64 in angularjs

一笑奈何 提交于 2019-11-30 03:51:30
I have a requirement where user will upload their image and i have to convert it into something and send it to .Net REStful service. I am new to angular js. Could someone please help Jaanus Answer from here https://stackoverflow.com/a/24880314/625189 I would recommend you to use https://github.com/ninjatronic/angular-base64 . After following instructions for using this library, you can simply call: var imageData=$base64.encode(image); Don't forget to inject in your module: .module('myApp', ['base64']) You can use the angular custom directive to convert the image base64. directive.js myApp

In opencv how do I copy and scale a greyscale image into another colour image

家住魔仙堡 提交于 2019-11-29 11:30:41
I want to composite a number of images into a single window in openCV. I had found i could create a ROI in one image and copy another colour image into this area without any problems. Switching the source image to an image i had carried out some processing on didn't work though. Eventually i found out that i'd converted the src image to greyscale and that when using the copyTo method that it didn't copy anything over. I've answered this question with my basic solution that only caters for greyscale to colour. If you use other Mat image types then you'd have to carry out the additional tests

rgb to ycbcr conversion in matlab

六眼飞鱼酱① 提交于 2019-11-29 05:21:23
I am trying to write a function in Matlab that takes an RGB image of class unit8 and double and converts it to a YCBCR image. The transformation formula is below. I would be really thankful for any help of any kind. There's an Image Processing Toolbox function for that, if you have access to it: RGB2YCBCR If you don't have access to it, here's how you can do the conversion yourself: rgbImage = imread('peppers.png'); %# A sample RGB image A = [65.481 -37.797 112; ... %# A 3-by-3 matrix of scale factors 128.553 -74.203 -93.786; ... 24.966 112 -18.214]; %# First convert the RGB image to double

Conversion from CMYK to RGB with Pillow is different from that of Photoshop

假如想象 提交于 2019-11-29 02:06:19
I need to convert an image from CMYK to RGB in python. I used Pillow in this way: img = Image.open('in.jpg') img = img.convert('RGB') img.save('out.jpg') The code works, but if I convert the same image with Photoshop I have a different result as shown below:- The only operation done in photoshop is to change method from CMYK to RGB. Why there is this difference between the two RGB images? It can be a color profile problem? SOLVED The problem is that Pillow does not know the input ICC profile, while photoshop had one set as default. Photoshop use for CMYK : U.S. Web Coated (SWOP) v2 RGB : sRGB

convert image to base64 in angularjs

[亡魂溺海] 提交于 2019-11-29 01:26:53
问题 I have a requirement where user will upload their image and i have to convert it into something and send it to .Net REStful service. I am new to angular js. Could someone please help 回答1: Answer from here https://stackoverflow.com/a/24880314/625189 I would recommend you to use https://github.com/ninjatronic/angular-base64. After following instructions for using this library, you can simply call: var imageData=$base64.encode(image); Don't forget to inject in your module: .module('myApp', [

Imagemagick Convert PDF to JPEG: FailedToExecuteCommand `“gswin32c.exe” / PDFDelegateFailed

大憨熊 提交于 2019-11-28 21:05:12
I have PDFs that I need to convert to images. I have installed Imagemagick. I have a PDF named a.pdf that I can open (it is not corrupt) in the folder C:\Convert\ From the command line I am trying C:\Convert>convert a.pdf a.jpg And I am getting the error. convert.exe: FailedToExecuteCommand `"gswin32c.exe" -q -dQUIET -dSAFER -dBATCH - dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEV ICE=pamcmyk32" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -dUseCIEColor "-sOutputFile=C:/Users/MNALDO~1.COR/AppData/Local/Temp/magick-3704HYGOqqIK5rhI%d " "-fC:/Users//MNALDO

Client-side conversion of rgb-jpg to 8-bit-jpg using Canvas+HTML5

邮差的信 提交于 2019-11-28 11:40:23
Many articles shows ways of converting jpeg files to grayscale using canvas+html5 at the client-side. But what I need is to convert an image to 8bit grayscale to reduce its size before uploading to my server. Is it possible to do it using canvas+html5? The whatwg specification mentions a toBlob method, which is supposed to convert the canvas to a jpeg or png and give you the binary representation. Unfortunately, it isn't widely supported yet. So all you can do is use getImageData to get an array of the bytes of the raw image data. In this array, every pixel is represented by 4 bytes: red,