WordPress database error: [INSERT, UPDATE command denied to user '51213-2'@'10.10.20.17' for table 'wp_options']
INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES ('_transient_doing_cron', '1714515325.0702760219573974609375', 'yes') ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)


Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372

Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/rest-api/class-wp-rest-server.php on line 1372
{"id":1500,"date":"2013-07-16T09:15:39","date_gmt":"2013-07-16T07:15:39","guid":{"rendered":"http:\/\/www.jonathanantoine.com\/?p=1500"},"modified":"2013-07-16T09:17:09","modified_gmt":"2013-07-16T07:17:09","slug":"winrt-how-to-easily-get-the-dominant-color-of-a-picture","status":"publish","type":"post","link":"http:\/\/www.jonathanantoine.com\/2013\/07\/16\/winrt-how-to-easily-get-the-dominant-color-of-a-picture\/","title":{"rendered":"#WinRT : how to easily get the dominant color of a picture"},"content":{"rendered":"

“Content before Chrome” is the Leitmotif of Windows Store Apps. You’ll usually end up using a lot of images in your app and getting the dominant color of a picture may actually be useful. My first attempt to achieve this was to get the bytes of the picture and calculate the average value. There is actually an easier and faster solution using the Windows Rutime API.<\/strong><\/p>\n

<\/p>\n

The GetPixelDataAsync<\/a> method of the BitmapDecoder<\/a> class lets you get the pixels of a given picture and you can apply transformations during the process. I will the simply ask it to resize the image to a simple unique pixel. The resulting pixel will be the dominant color of the image.<\/p>\n

[csharp]
\n\/\/get the file
\nvar file = await StorageFile.GetFileFromApplicationUriAsync(myLocalImageUri);<\/p>\n

using (var stream = await file.OpenAsync(FileAccessMode.Read))
\n{
\n \/\/Create a decoder for the image
\n var decoder = await BitmapDecoder.CreateAsync(stream);<\/p>\n

\/\/Create a transform to get a 1×1 image
\n var myTransform = new BitmapTransform { ScaledHeight = 1, ScaledWidth = 1 };<\/p>\n

\/\/Get the pixel provider
\n var pixels = await decoder.GetPixelDataAsync(
\n BitmapPixelFormat.Rgba8,
\n BitmapAlphaMode.Ignore,
\n myTransform ,
\n ExifOrientationMode.IgnoreExifOrientation,
\n ColorManagementMode.DoNotColorManage);<\/p>\n

\/\/Get the bytes of the 1×1 scaled image
\n var bytes = pixels.DetachPixelData();<\/p>\n

\/\/read the color
\n var myDominantColor = Color.FromArgb(255, bytes[0], bytes[1], bytes[2]);
\n}<\/p>\n

[\/csharp]<\/p>\n

The code is extremely simple: open the file, open its stream, create a BitmapDecoder, grab the pixels applying the transform and read the color.<\/strong>
\n
\"dominant<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"

“Content before Chrome” is the Leitmotif of Windows Store Apps. You’ll usually end up using a lot of images in your app and getting the dominant color of a picture may actually be useful. My…<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[28,35,5],"tags":[14,15,30,34,25,53,29,40,24],"_links":{"self":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts\/1500"}],"collection":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/comments?post=1500"}],"version-history":[{"count":7,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts\/1500\/revisions"}],"predecessor-version":[{"id":1508,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/posts\/1500\/revisions\/1508"}],"wp:attachment":[{"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/media?parent=1500"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/categories?post=1500"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.jonathanantoine.com\/wp-json\/wp\/v2\/tags?post=1500"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}