jpg

jpg or png for UIImage ― which is more efficient?

匿名 (未验证) 提交于 2019-12-03 02:49:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am grabbing an image from the camera roll and then using it for a while as well as save it to disk as a PNG on the iPhone. I am getting the odd crash, presumably due to out of memory. Does it make a difference if I save it as PNG or JPG (assuming I choose note to degrade the quality in the JPG case)? Specifically: is more memory then used by the UIImage after I reload it off of disk if I saved it as a PNG? is it possible the act of saving as PNG uses up more memory transiently during the saving process? I had been assuming the UIImage was

How to respond_to PNG or JPG in Rails and generate image from HTML?

匿名 (未验证) 提交于 2019-12-03 02:45:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am looking for a gem or solution to generate image in controller response. It would be nice if it's possible to do in controller like that: respond_to :html, :png def show ... respond_to do |format| format.html format.png { ??? } # some html to png converter end end When the png format is requested the response handles with template: #show.png.haml %h1 Some title %p Some content The result should be an image. I know about pdf generation solutions PDFKit , prawn and am looking for image generation. Does anybody know working solution/example

Saving canvas as a PNG or JPG

匿名 (未验证) 提交于 2019-12-03 02:45:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to save canvas as PNG, without opening it in a new window as base64-encoded image. I used this code: jQuery("#btnPreview").click(function(){ if (!fabric.Canvas.supports('toDataURL')) { alert('Sorry, your browser is not supported.'); } else { canvas.deactivateAll(); canvas.forEachObject(function(o){ if(o.get("title") == "||Watermark||"){ canvas.bringToFront(o); } }); window.open(canvas.toDataURL('png'), ""); canvas.forEachObject(function(o){ if(o.get("title") == "||Watermark||"){ canvas.sendToBack(o); } }); canvas.renderAll(); } }); I

Android: Overlay a picture (jpg) with transparency

匿名 (未验证) 提交于 2019-12-03 02:44:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a picture (jpg) that I want to display on the screen. Additionally the picture should be covered partially by a transparent effect. The transparent cover should be dynamic. So e.g. each day more of the picture is shown. Here a picture to show what I mean: I have the picture without the gray cover and want to add this cover but in different steps. Can someone give me a hint how to do that. 回答1: You can do this simply with widgets: FrameLayout is the general mechanism for overlaying a view on top of another: <?xml version="1.0" encoding

ImageMagick convert jpg images to gif slow

匿名 (未验证) 提交于 2019-12-03 02:33:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using Magick++(IM 7.0.3 platform:CentOS Linux release 7.0) to convert images to gif. I create Image objects from files, the problem is that when I convert 9 png files(each 50kb) to gif, it taks only 50ms. but when it turns to 9 jpg files (each 20kb), it takes 1900ms. What is the reason behind? How can I make it faster with jpg files? for(int i = 2; i < argc-1; i++) { // I pass the file path from command line cout << argv[i] << endl; Image img(argv[i]); img.animationDelay(delay); img.magick("GIF"); frames.push_back(img); } long

Read a binary file (jpg) to a string using c++

匿名 (未验证) 提交于 2019-12-03 02:24:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I need to read a jpg file to a string. I want to upload this file to our server, I just find out that the API requires a string as the data of this pic. I followed the suggestions in a former question I've asked Upload pics to a server using c++ . int main() { ifstream fin("cloud.jpg"); ofstream fout("test.jpg");//for testing purpose, to see if the string is a right copy ostringstream ostrm; unsigned char tmp; int count = 0; while ( fin >> tmp ) { ++count;//for testing purpose ostrm << tmp; } string data( ostrm.str() ); cout << count << endl

JPG File Size Optimization - PHP, ImageMagick, &amp; Google&#039;s Page Speed

匿名 (未验证) 提交于 2019-12-03 02:17:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have photo gallery code that does image re-sizing and thumbnail creation. I use ImageMagick to do this. I ran a gallery page through Google's Page Speed tool and it revealed that the re-sized images and thumbnails both have about an extra 10KB of data (JPEG files specifically). What can I add to my scripts to optimize the file size? ADDITIONAL INFORMATION I am using the imagick::FILTER_LANCZOS filter with a blur setting of 0.9 when calling the resizeImage() function. JPEGs have a quality setting of 80 . 回答1: I found this SO question, "

PIL - Convert GIF Frames to JPG

匿名 (未验证) 提交于 2019-12-03 02:14:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I tried to convert an gif to single images with Python Image Library, but it results in weird frames The Input gif is: Source Image http://longcat.de/gif_example.gif In my first try, i tried to convert the image with Image.new to an RGB image, with 255,255,255 as white background - like in any other example i've found on the internet: def processImage ( infile ): try : im = Image . open ( infile ) except IOError : print "Cant load" , infile sys . exit ( 1 ) i = 0 try : while 1 : background = Image . new ( "RGB" , im . size , ( 255

Convert image (jpg) to base64 in Excel VBA?

匿名 (未验证) 提交于 2019-12-03 02:14:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I need to convert an image inside Excel (or through VBA) to base64 (in the end I will make XML output). How can I do this? Do I need to make a reference to DOM? this question but it only works for text strings not images... Does anyone have any code that I can see? 回答1: Heres a function. Can't remember where I got it from. Public Function EncodeFile ( strPicPath As String ) As String Const adTypeBinary = 1 ' Binary file is encoded ' Variables for encoding Dim objXML Dim objDocElem ' Variable for reading binary picture Dim objStream

Convert PDF to JPG / Images without using a specific C# Library [closed]

匿名 (未验证) 提交于 2019-12-03 02:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: is there a free C# library ( .dll ) to convert PDF to images ? I tried this one : https://code.google.com/p/lib-pdf/ But it doesn't work, I got this error : Could not load file or assembly 'libpdf.DLL' or one of its dependencies . The specified module could not be found . iTextSharp doesn't implement a function like that either.. EDIT: I didn't use ghost scrpit because you had to install it before on the computer But now I found a solution : if you load manualy the dll it works http://ghostscriptnet.codeplex.com/discussions/465418