{"id":1585,"date":"2013-11-01T15:10:51","date_gmt":"2013-11-01T14:10:51","guid":{"rendered":"https:\/\/ridgesolutions.ie\/?p=1585"},"modified":"2013-11-22T14:32:41","modified_gmt":"2013-11-22T13:32:41","slug":"write-jpeg-with-comment-boost-generic-image-library-gil","status":"publish","type":"post","link":"https:\/\/www.ridgesolutions.ie\/index.php\/2013\/11\/01\/write-jpeg-with-comment-boost-generic-image-library-gil\/","title":{"rendered":"Write jpeg with header comment &#8211; boost generic image library (gil)"},"content":{"rendered":"<p>I had to hack the living daylights out of something today, and although I am not proud of it, needs must where the devil drives!<\/p>\n<p>I was using the boost generic image library (gil) for managing some camera images and using jpeg_write_view() for saving them as JPEGs.  A requirement emerged to insert a comment into the header of the saved images, but the gil does not support this out of the box.<\/p>\n<p>The gil uses libjpeg for writing its JPEGs and adding a comment in libjped is as easy as calling jpeg_write_marker().  The problem was that the gil buries libjpeg calls under a few classes so I had to copy and paste some of this in order to redefine a new writer which supports comments.<\/p>\n<p>Anyway I have included the extra code inline below, it adds a new helper function called jpeg_write_view_comment()<\/p>\n<p>Use this new function like this:<\/p>\n<pre>\r\n\r\n int quality = 70;\r\n jpeg_write_view_comment(\"image1.jpg\", view, quality, \"a comment damn it!!!\");\r\n\r\n<\/pre>\n<p>Here is the extra code which I placed in a file called jpeg_writer_comment.h<\/p>\n<pre>\r\n#pragma once\r\n\r\n#include \"boost\/gil\/extension\/io\/dynamic_io.hpp\"\r\n\r\nusing namespace boost;\r\nusing namespace boost::gil;\r\nusing namespace boost::gil::detail;\r\n\r\nclass jpeg_writer_comment : public file_mgr {\r\n    jpeg_compress_struct _cinfo;\r\n    jpeg_error_mgr _jerr;\r\n\r\n    void init() {\r\n        _cinfo.err=jpeg_std_error(&_jerr);\r\n        jpeg_create_compress(&_cinfo);\r\n        jpeg_stdio_dest(&_cinfo,_fp.get());\r\n    }\r\npublic:\r\n    jpeg_writer_comment(FILE* file)           : file_mgr(file)           { init(); }\r\n    jpeg_writer_comment(const char* filename) : file_mgr(filename, \"wb\") { init(); }\r\n    ~jpeg_writer_comment() { jpeg_destroy_compress(&_cinfo); }\r\n\r\n    template <typename View>\r\n    void apply(const View& view,int quality=100, const char* comment = NULL) {\r\n        _cinfo.image_width  = (JDIMENSION)view.width();\r\n        _cinfo.image_height = (JDIMENSION)view.height();\r\n        _cinfo.input_components=num_channels<View>::value;\r\n        _cinfo.in_color_space = jpeg_write_support_private<typename channel_type<View>::type,\r\n                                                           typename color_space_type<View>::type>::color_type;\r\n        jpeg_set_defaults(&_cinfo);\r\n        jpeg_set_quality(&_cinfo, quality, TRUE);\r\n        jpeg_start_compress(&_cinfo, TRUE);\r\n\r\n        if (comment) {\r\n        \tjpeg_write_marker(&_cinfo, JPEG_COM, (const JOCTET*)comment, strlen(comment));\r\n        }\r\n\r\n        std::vector<pixel<bits8,layout<typename color_space_type<View>::type> > > row(view.width());\r\n        JSAMPLE* row_address=(JSAMPLE*)&row.front();\r\n        for (int y=0;y<view.height(); ++y) {\r\n            std::copy(view.row_begin(y),view.row_end(y),row.begin());\r\n            io_error_if(jpeg_write_scanlines(&#038;_cinfo,(JSAMPARRAY)&#038;row_address,1) != 1,\r\n                        \"jpeg_writer::apply(): fail to write file\");\r\n        }\r\n        jpeg_finish_compress(&#038;_cinfo);\r\n    }\r\n};\r\n\r\nclass jpeg_writer_dynamic_comment : public jpeg_writer_comment {\r\n    int _quality;\r\npublic:\r\n    jpeg_writer_dynamic_comment(FILE* file,           int quality=100) : jpeg_writer_comment(file)    , _quality(quality) {}\r\n    jpeg_writer_dynamic_comment(const char* filename, int quality=100) : jpeg_writer_comment(filename), _quality(quality) {}\r\n\r\n    template <typename Views>\r\n    void write_view(const any_image_view<Views>& runtime_view) {\r\n        dynamic_io_fnobj<jpeg_write_is_supported, jpeg_writer_comment> op(this);\r\n        apply_operation(runtime_view,op);\r\n    }\r\n};\r\n\r\n\r\n\r\ntemplate <typename View>\r\ninline void jpeg_write_view_comment(const char* filename,const View& view,int quality=100, const char* comment = NULL) {\r\n    BOOST_STATIC_ASSERT(jpeg_write_support<View>::is_supported);\r\n\r\n    jpeg_writer_comment m(filename);\r\n    m.apply(view, quality, comment);\r\n}\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I had to hack the living daylights out of something today, and although I am not proud of it, needs must where the devil drives! I was using the boost generic image library (gil) for managing some camera images and using jpeg_write_view() for saving them as JPEGs. A requirement emerged to insert a comment into [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[228,292],"class_list":["post-1585","post","type-post","status-publish","format-standard","hentry","category-tech-stuff","tag-boost","tag-gil"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"I had to hack the living daylights out of something today, and although I am not proud of it, needs must where the devil drives! I was using the boost generic image library (gil) for managing some camera images and using jpeg_write_view() for saving them as JPEGs. A requirement emerged to insert a comment into\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Kevin Godden\"\/>\n\t<meta name=\"google-site-verification\" content=\"Kyj52YLp6GOPA44PVBffo9fjW8rgWHYYRF0ZYjfy6ss\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.ridgesolutions.ie\/index.php\/2013\/11\/01\/write-jpeg-with-comment-boost-generic-image-library-gil\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Systems and Embedded Software Engineering, Ireland. | Some thoughts of a busy Computer Engineer\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Write jpeg with header comment \u2013 boost generic image library (gil)\" \/>\n\t\t<meta property=\"og:description\" content=\"I had to hack the living daylights out of something today, and although I am not proud of it, needs must where the devil drives! I was using the boost generic image library (gil) for managing some camera images and using jpeg_write_view() for saving them as JPEGs. A requirement emerged to insert a comment into\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.ridgesolutions.ie\/index.php\/2013\/11\/01\/write-jpeg-with-comment-boost-generic-image-library-gil\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2013-11-01T14:10:51+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2013-11-22T13:32:41+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Write jpeg with header comment \u2013 boost generic image library (gil)\" \/>\n\t\t<meta name=\"twitter:description\" content=\"I had to hack the living daylights out of something today, and although I am not proud of it, needs must where the devil drives! I was using the boost generic image library (gil) for managing some camera images and using jpeg_write_view() for saving them as JPEGs. A requirement emerged to insert a comment into\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/2013\\\/11\\\/01\\\/write-jpeg-with-comment-boost-generic-image-library-gil\\\/#article\",\"name\":\"Write jpeg with header comment \\u2013 boost generic image library (gil)\",\"headline\":\"Write jpeg with header comment &#8211; boost generic image library (gil)\",\"author\":{\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/author\\\/kgodden\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/wp-content\\\/uploads\\\/2013\\\/09\\\/ridge_logo1.jpg\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/#articleImage\",\"width\":400,\"height\":81},\"datePublished\":\"2013-11-01T15:10:51+00:00\",\"dateModified\":\"2013-11-22T14:32:41+00:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/2013\\\/11\\\/01\\\/write-jpeg-with-comment-boost-generic-image-library-gil\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/2013\\\/11\\\/01\\\/write-jpeg-with-comment-boost-generic-image-library-gil\\\/#webpage\"},\"articleSection\":\"Tech Stuff, boost, gil\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/2013\\\/11\\\/01\\\/write-jpeg-with-comment-boost-generic-image-library-gil\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.ridgesolutions.ie\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/category\\\/tech-stuff\\\/#listItem\",\"name\":\"Tech Stuff\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/category\\\/tech-stuff\\\/#listItem\",\"position\":2,\"name\":\"Tech Stuff\",\"item\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/category\\\/tech-stuff\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/2013\\\/11\\\/01\\\/write-jpeg-with-comment-boost-generic-image-library-gil\\\/#listItem\",\"name\":\"Write jpeg with header comment &#8211; boost generic image library (gil)\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/2013\\\/11\\\/01\\\/write-jpeg-with-comment-boost-generic-image-library-gil\\\/#listItem\",\"position\":3,\"name\":\"Write jpeg with header comment &#8211; boost generic image library (gil)\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/category\\\/tech-stuff\\\/#listItem\",\"name\":\"Tech Stuff\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/#organization\",\"name\":\"Ridge Solutions, Software Development and Software Engineering, Ireland.\",\"description\":\"Some thoughts of a busy Computer Engineer\",\"url\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/wp-content\\\/uploads\\\/2013\\\/09\\\/ridge_logo1.jpg\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/2013\\\/11\\\/01\\\/write-jpeg-with-comment-boost-generic-image-library-gil\\\/#organizationLogo\",\"width\":400,\"height\":81},\"image\":{\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/2013\\\/11\\\/01\\\/write-jpeg-with-comment-boost-generic-image-library-gil\\\/#organizationLogo\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/author\\\/kgodden\\\/#author\",\"url\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/author\\\/kgodden\\\/\",\"name\":\"Kevin Godden\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/2013\\\/11\\\/01\\\/write-jpeg-with-comment-boost-generic-image-library-gil\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d2833f41e59a25cf2a9741a05ec383bfdd278762a5e0798a90940e7ab0a107a2?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Kevin Godden\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/2013\\\/11\\\/01\\\/write-jpeg-with-comment-boost-generic-image-library-gil\\\/#webpage\",\"url\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/2013\\\/11\\\/01\\\/write-jpeg-with-comment-boost-generic-image-library-gil\\\/\",\"name\":\"Write jpeg with header comment \\u2013 boost generic image library (gil)\",\"description\":\"I had to hack the living daylights out of something today, and although I am not proud of it, needs must where the devil drives! I was using the boost generic image library (gil) for managing some camera images and using jpeg_write_view() for saving them as JPEGs. A requirement emerged to insert a comment into\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/2013\\\/11\\\/01\\\/write-jpeg-with-comment-boost-generic-image-library-gil\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/author\\\/kgodden\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/index.php\\\/author\\\/kgodden\\\/#author\"},\"datePublished\":\"2013-11-01T15:10:51+00:00\",\"dateModified\":\"2013-11-22T14:32:41+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/#website\",\"url\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/\",\"name\":\"Ridge Solutions, Software Development and Software Engineering, Ireland.\",\"description\":\"Some thoughts of a busy Computer Engineer\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.ridgesolutions.ie\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Write jpeg with header comment \u2013 boost generic image library (gil)","description":"I had to hack the living daylights out of something today, and although I am not proud of it, needs must where the devil drives! I was using the boost generic image library (gil) for managing some camera images and using jpeg_write_view() for saving them as JPEGs. A requirement emerged to insert a comment into","canonical_url":"https:\/\/www.ridgesolutions.ie\/index.php\/2013\/11\/01\/write-jpeg-with-comment-boost-generic-image-library-gil\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"google-site-verification":"Kyj52YLp6GOPA44PVBffo9fjW8rgWHYYRF0ZYjfy6ss","miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.ridgesolutions.ie\/index.php\/2013\/11\/01\/write-jpeg-with-comment-boost-generic-image-library-gil\/#article","name":"Write jpeg with header comment \u2013 boost generic image library (gil)","headline":"Write jpeg with header comment &#8211; boost generic image library (gil)","author":{"@id":"https:\/\/www.ridgesolutions.ie\/index.php\/author\/kgodden\/#author"},"publisher":{"@id":"https:\/\/www.ridgesolutions.ie\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/www.ridgesolutions.ie\/wp-content\/uploads\/2013\/09\/ridge_logo1.jpg","@id":"https:\/\/www.ridgesolutions.ie\/#articleImage","width":400,"height":81},"datePublished":"2013-11-01T15:10:51+00:00","dateModified":"2013-11-22T14:32:41+00:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/www.ridgesolutions.ie\/index.php\/2013\/11\/01\/write-jpeg-with-comment-boost-generic-image-library-gil\/#webpage"},"isPartOf":{"@id":"https:\/\/www.ridgesolutions.ie\/index.php\/2013\/11\/01\/write-jpeg-with-comment-boost-generic-image-library-gil\/#webpage"},"articleSection":"Tech Stuff, boost, gil"},{"@type":"BreadcrumbList","@id":"https:\/\/www.ridgesolutions.ie\/index.php\/2013\/11\/01\/write-jpeg-with-comment-boost-generic-image-library-gil\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.ridgesolutions.ie#listItem","position":1,"name":"Home","item":"https:\/\/www.ridgesolutions.ie","nextItem":{"@type":"ListItem","@id":"https:\/\/www.ridgesolutions.ie\/index.php\/category\/tech-stuff\/#listItem","name":"Tech Stuff"}},{"@type":"ListItem","@id":"https:\/\/www.ridgesolutions.ie\/index.php\/category\/tech-stuff\/#listItem","position":2,"name":"Tech Stuff","item":"https:\/\/www.ridgesolutions.ie\/index.php\/category\/tech-stuff\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.ridgesolutions.ie\/index.php\/2013\/11\/01\/write-jpeg-with-comment-boost-generic-image-library-gil\/#listItem","name":"Write jpeg with header comment &#8211; boost generic image library (gil)"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.ridgesolutions.ie#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.ridgesolutions.ie\/index.php\/2013\/11\/01\/write-jpeg-with-comment-boost-generic-image-library-gil\/#listItem","position":3,"name":"Write jpeg with header comment &#8211; boost generic image library (gil)","previousItem":{"@type":"ListItem","@id":"https:\/\/www.ridgesolutions.ie\/index.php\/category\/tech-stuff\/#listItem","name":"Tech Stuff"}}]},{"@type":"Organization","@id":"https:\/\/www.ridgesolutions.ie\/#organization","name":"Ridge Solutions, Software Development and Software Engineering, Ireland.","description":"Some thoughts of a busy Computer Engineer","url":"https:\/\/www.ridgesolutions.ie\/","logo":{"@type":"ImageObject","url":"https:\/\/www.ridgesolutions.ie\/wp-content\/uploads\/2013\/09\/ridge_logo1.jpg","@id":"https:\/\/www.ridgesolutions.ie\/index.php\/2013\/11\/01\/write-jpeg-with-comment-boost-generic-image-library-gil\/#organizationLogo","width":400,"height":81},"image":{"@id":"https:\/\/www.ridgesolutions.ie\/index.php\/2013\/11\/01\/write-jpeg-with-comment-boost-generic-image-library-gil\/#organizationLogo"}},{"@type":"Person","@id":"https:\/\/www.ridgesolutions.ie\/index.php\/author\/kgodden\/#author","url":"https:\/\/www.ridgesolutions.ie\/index.php\/author\/kgodden\/","name":"Kevin Godden","image":{"@type":"ImageObject","@id":"https:\/\/www.ridgesolutions.ie\/index.php\/2013\/11\/01\/write-jpeg-with-comment-boost-generic-image-library-gil\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/d2833f41e59a25cf2a9741a05ec383bfdd278762a5e0798a90940e7ab0a107a2?s=96&d=mm&r=g","width":96,"height":96,"caption":"Kevin Godden"}},{"@type":"WebPage","@id":"https:\/\/www.ridgesolutions.ie\/index.php\/2013\/11\/01\/write-jpeg-with-comment-boost-generic-image-library-gil\/#webpage","url":"https:\/\/www.ridgesolutions.ie\/index.php\/2013\/11\/01\/write-jpeg-with-comment-boost-generic-image-library-gil\/","name":"Write jpeg with header comment \u2013 boost generic image library (gil)","description":"I had to hack the living daylights out of something today, and although I am not proud of it, needs must where the devil drives! I was using the boost generic image library (gil) for managing some camera images and using jpeg_write_view() for saving them as JPEGs. A requirement emerged to insert a comment into","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.ridgesolutions.ie\/#website"},"breadcrumb":{"@id":"https:\/\/www.ridgesolutions.ie\/index.php\/2013\/11\/01\/write-jpeg-with-comment-boost-generic-image-library-gil\/#breadcrumblist"},"author":{"@id":"https:\/\/www.ridgesolutions.ie\/index.php\/author\/kgodden\/#author"},"creator":{"@id":"https:\/\/www.ridgesolutions.ie\/index.php\/author\/kgodden\/#author"},"datePublished":"2013-11-01T15:10:51+00:00","dateModified":"2013-11-22T14:32:41+00:00"},{"@type":"WebSite","@id":"https:\/\/www.ridgesolutions.ie\/#website","url":"https:\/\/www.ridgesolutions.ie\/","name":"Ridge Solutions, Software Development and Software Engineering, Ireland.","description":"Some thoughts of a busy Computer Engineer","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.ridgesolutions.ie\/#organization"}}]},"og:locale":"en_US","og:site_name":"Systems and Embedded Software Engineering, Ireland. | Some thoughts of a busy Computer Engineer","og:type":"article","og:title":"Write jpeg with header comment \u2013 boost generic image library (gil)","og:description":"I had to hack the living daylights out of something today, and although I am not proud of it, needs must where the devil drives! I was using the boost generic image library (gil) for managing some camera images and using jpeg_write_view() for saving them as JPEGs. A requirement emerged to insert a comment into","og:url":"https:\/\/www.ridgesolutions.ie\/index.php\/2013\/11\/01\/write-jpeg-with-comment-boost-generic-image-library-gil\/","article:published_time":"2013-11-01T14:10:51+00:00","article:modified_time":"2013-11-22T13:32:41+00:00","twitter:card":"summary","twitter:title":"Write jpeg with header comment \u2013 boost generic image library (gil)","twitter:description":"I had to hack the living daylights out of something today, and although I am not proud of it, needs must where the devil drives! I was using the boost generic image library (gil) for managing some camera images and using jpeg_write_view() for saving them as JPEGs. A requirement emerged to insert a comment into"},"aioseo_meta_data":{"post_id":"1585","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2021-09-13 21:18:39","updated":"2025-07-15 22:30:25","seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.ridgesolutions.ie\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.ridgesolutions.ie\/index.php\/category\/tech-stuff\/\" title=\"Tech Stuff\">Tech Stuff<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tWrite jpeg with header comment \u2013 boost generic image library (gil)\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.ridgesolutions.ie"},{"label":"Tech Stuff","link":"https:\/\/www.ridgesolutions.ie\/index.php\/category\/tech-stuff\/"},{"label":"Write jpeg with header comment &#8211; boost generic image library (gil)","link":"https:\/\/www.ridgesolutions.ie\/index.php\/2013\/11\/01\/write-jpeg-with-comment-boost-generic-image-library-gil\/"}],"_links":{"self":[{"href":"https:\/\/www.ridgesolutions.ie\/index.php\/wp-json\/wp\/v2\/posts\/1585","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ridgesolutions.ie\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ridgesolutions.ie\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ridgesolutions.ie\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ridgesolutions.ie\/index.php\/wp-json\/wp\/v2\/comments?post=1585"}],"version-history":[{"count":0,"href":"https:\/\/www.ridgesolutions.ie\/index.php\/wp-json\/wp\/v2\/posts\/1585\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.ridgesolutions.ie\/index.php\/wp-json\/wp\/v2\/media?parent=1585"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ridgesolutions.ie\/index.php\/wp-json\/wp\/v2\/categories?post=1585"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ridgesolutions.ie\/index.php\/wp-json\/wp\/v2\/tags?post=1585"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}