{"id":165,"date":"2010-01-04T21:43:02","date_gmt":"2010-01-05T05:43:02","guid":{"rendered":"http:\/\/hongyu.org\/wordpress\/?p=165"},"modified":"2010-01-29T11:02:32","modified_gmt":"2010-01-29T19:02:32","slug":"write-to-memory-instead-of-file-using-libjpeg-and-libpng","status":"publish","type":"post","link":"https:\/\/www.hongyu.org\/wordpress\/?p=165","title":{"rendered":"Output to memory instead of file using libjpeg and libpng"},"content":{"rendered":"<p>I need to use libjpeg and libpng to convert an image from the raw RGB format to JPEG and PNG format and then output the result to a memory buffer, and the following two links saved me lots of coding effort:<\/p>\n<p><a href=\"http:\/\/www.codeguru.com\/forum\/archive\/index.php\/t-378333.html\">http:\/\/www.codeguru.com\/forum\/archive\/index.php\/t-378333.html<\/a><\/p>\n<p><a href=\"http:\/\/stackoverflow.com\/questions\/1821806\/how-to-encode-png-to-buffer-using-libpng\">http:\/\/stackoverflow.com\/questions\/1821806\/how-to-encode-png-to-buffer-using-libpng<\/a><\/p>\n<p>\nAdditionally, there is also a good online tutorial showing how to do in-memory data compression using zlib at<br \/>\n<a href=\"http:\/\/www.gamedev.net\/reference\/articles\/article2279.asp\">http:\/\/www.gamedev.net\/reference\/articles\/article2279.asp<\/a><\/p>\n<p>PS: just found out that the latest libjpeg (version 8 ) coming out two weeks ago added the in-memory compression method. Cheers!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I need to use libjpeg and libpng to convert an image from the raw RGB format to JPEG and PNG format and then output the result to a memory buffer, and the following two links saved me lots of coding effort: http:\/\/www.codeguru.com\/forum\/archive\/index.php\/t-378333.html http:\/\/stackoverflow.com\/questions\/1821806\/how-to-encode-png-to-buffer-using-libpng Additionally, there is also a good online tutorial showing how to do &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.hongyu.org\/wordpress\/?p=165\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Output to memory instead of file using libjpeg and libpng&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/165"}],"collection":[{"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=165"}],"version-history":[{"count":7,"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/165\/revisions"}],"predecessor-version":[{"id":192,"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/165\/revisions\/192"}],"wp:attachment":[{"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=165"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=165"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hongyu.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}