Why can't I apply effects to images in Cloudinary folder? - image

I'm trying out Cloudinary to get optimized images, and as a placeholder I want a blurred image. If the image is in my root media folder, this is no problem, see for instance this url:
https://res.cloudinary.com/dvghwblv8/image/upload/e_blur:2000,f_webp/sample.jpg
However, if I want to apply an effect to an image in one of my folders, I get a 404:
https://res.cloudinary.com/dvghwblv8/image/upload/q_auto,f_webp,e_blur:1000/samples/landscapes/landscape-panorama
Notice that as soon as I remove my effect, I do get my image:
https://res.cloudinary.com/dvghwblv8/image/upload/q_auto,f_webp/samples/landscapes/landscape-panorama
Why can I not apply effects to images that are in a folder?

Generally, when Cloudinary returns an error for an image/video URL that failed to load due to a problem with the image/video or URL, they will return an HTTP header containing more information about why the request failed.
They also return this header for requests where an image was returned but there was a warning, such as when the default image placeholder was sent instead of the requested image.
This information is sent in the x-cld-error header, and you can see the value by using your browser's web developer tools to examine the request and response for the image which didn't load correctly.
In your current case, the specific error is:
Maximum image size is 25 Megapixels. Requested 25.62 Megapixels
The error is returned as the dimensions of the output image (10,906px by 2,349px - (which are the original image dimensions as no resizing has been requested in your URL) - contains more Megapixels than your account's limit.
You can bypass this error by applying some resizing transformations to your image which will reduce the total number of megapixels of the output. You will not only want to do that to avoid this issue but also because delivering such a large image will result in a large output image in terms of bytes which will then count against your Bandwidth quota in Cloudinary for every request - for instance, the q_auto,f_webp is almost 3MB in size at the original image dimensions.
For example, you can ask Cloudinary to scale the image to 2,000px width (by adding c_scale and w_2000) as follows and then your blurred image will generate and be returned:
https://res.cloudinary.com/dvghwblv8/image/upload/c_scale,q_auto,f_webp,e_blur:1000,w_2000/samples/landscapes/landscape-panorama
The above resized version is also only 14.4KB in size and the same w_2000 version and without e_blur it's 115KB - a lot less than the 3MB image when just using q_auto,f_webp and the original (10,906x2,349) dimensions.

Related

Dropzone js uplaod 2 sizes of picture

I haven't dive in to trying the library out because I am trying to find out if this is possible.
I want to have the client side create a thumbnail as well as optimize the orignal file for web use. So upload maybe a 30x30 or 50x50 thumbnail and then a full size image like 600x600 or 800x800 With the same post request. Then I will be able to provide the serve the photos directly from what was uploaded.
If this is possible, what would the thumbnail be, post file[1] and full image, size file[0]
Is it possible to set it up to allow multiple post request for multiple images where each request has both a thumbnail and a full size image?
Is not a built in feature in dropzone but it is possible, but I think the easiest approach using dropzone would be to send the full image as a file, and the thumbnail as a text input field with the thumbnail base 64 encoded.
And yes you can configure dropzone to send an independent request for every image with one of this pairs per request.

SSRS can't properly render *some* images within PDF

I have a report that renders images (jpg) that have been collected from various sources. This works fine within the report viewer, and when exporting via Excel.
However, when exporting to PDF, about 5% of the images are rendered incorrectly as can be seen below, with the original on the left, and what is rendered on the right;
I find that if I open up one of these images in mspaint, and just click save, on the next report-run the image is now rendered correctly.
Are there any rules as to what image properties/format are valid for SSRS to render the image correctly within a PDF? Essentially I'd like to somehow find these images that will render incorrectly before the report is run and fix them prior...
Current Workaround
I never ended up getting SSRS to display the the problem images as they were, however, determining before running the report which images would be included in the non-displayable set so they could be converted to a supported format (automatically) was also a solution.
In my case, all images were supplied via users uploading to a website, so I was able to identify and convert images as they arrived. For all existing images, I was able to run a script that identified the problem images and convert them.
Identifying problem images
From the thousands of images I had, I was able to determine that the images that wouldn't render correctly had the following properties:
Image had CMYK colorspace or;
Image had extended color profiles or;
Both of the above
Converting an image
I was originally using the standard .NET GDI (System.Drawing) to manipulate images however the API is often prone to crashes (OutOfMemoryException) when dealing with images that have extra data. As such, I switched to using ImageMagick where for each of the identified images I:
Stripped the color profiles and;
Converted to RGB
Note that the conversion to RGB from CMYK without stripping the color profiles was not enough to get all images to render properly.
I ended up just doing those items on every image byte stream I received from users (without first identifying the problem) before saving an uploaded image to disk. After which, I never had the rendering problem again.
Because of the way the output looks I would say those JPEG images have CMYK colorspace but the SSRS assumes they use RGB colorspace and sets the wrong colorspace in PDF.
If you can post a JPEG image and a sample PDF I can give you more details.
I've had exactly the same problem with an image rendering correctly on screen but appearing like the one in the question when I exported the report to PDF. Here's how I solved it.
The Problem
The first clue was this article I came across on MSDN. It seems that regardless of the original image density, the PDF renderer in SSRS resizes all images to 96 DPI. If the original size of the image is larger than the size of the page (or container), then you will get this problem.
The Solution
The solution is to resize the source image such that it will fit on your page. The requires a little calculation depending on your page size and margin settings.
In my case, I'm using A4 paper size, which is 21cm by 29.7cm. However, my left margin is 1.5cm, and my right margin is 0.5cm, for a total inner width of 19cm. I allow an extra 0.5 cm as a margin of error, so I use an inner width of 18.5cm.
21 cm - 1.5 cm - 0.5 cm - 0.5 cm = 18.5 cm
As noted before, the resolution generated by the PDF renderer is 96 DPI (dots per inch). For those of us not in the United States or Republic of Liberia, that's 37.79 DPC (dots per centimetre). So, to get our width:
18.5 cm * 37.79 dpc = 699 pixels
Your result may be different depending on (1) the paper size you are using, and (2) the left and right margins.
As the page is higher than it is wide, we need only resize the width while keeping the image proportional. If you're using a paper size which is wider than it is tall, you'd use the length instead.
So now open the source image in Paint (or your image editor of choice), and proportionally resize the image to the desired width (or length) in pixels, save it, import it into your container, and size the image visually with respect to the container. It should look the same on screen, and now render correctly to PDF.
This is an issue reported to Microsoft Connect.
From SSRS 2008 How to get the best image quality possible?:
The image behavior you see in PDF is a result of some image conversions that the PDF renderer does, based on how the PDF specification requires that serialize images into PDF.
We know it's not ideal, and we classify the loss of image quality as a product issue. Therefore, it's difficult to really say what to do to get the best quality image.
Anecdotally, I have heard that customers have good results when the original image is a BMP

Disable color correction in Firefox programatically per image?

this question is in close relation to Firefox 3.5 color correction hack?
The situation I have is that there's a canvas game of mine, and the images that are used in it carry additional information about their shape, connection points etc. This information is stored in the PNG image itself, using meaningful colours (eg RGB(255,255,0) for connection point).
Loading element and painting on the canvas creates Image object, img.src is set, and in img.load function I preprocess image data reading the sensitive information (and removing sensitive pixels from the image data before painting to canvas).
The problem: In FF, the pixel which was supposed to be 255,255,0 is actually 255,254,0. I don't have problems with FF color correction (I don't care if the displayed image has right colors, or slightly modified), but I'd expect that getting image data gives me uncorrected data. I'm looking for a solution which would not involve changing images on the server. Is there some way? Eg.
img.setColorProfile(), or
img.disableColorCorrection(), or
img.getImageData(disableColorCorrection) or img.getImageData(colorProfile)?
The problem might have do more with image loading than image drawing.
I think the proper solution is to strip out color profile information from the images (which you seem to want to aovid). If possible server another image resources for Firefox if you cannot need to have the original data intact.
http://f6design.com/journal/2006/12/01/fixing-png-gamma/
Also, you could decode PNG immages in pure Javascript if the server is co-operate and allows CORS and AJAX loading of the images. You decode the image in Javascript using png.js and create a source <canvas> from the image data (instead of <img>). This way it's you in the control what RGB values comes out from each PNG pixel.
https://github.com/devongovett/png.js

Google App Engine. Resize only big images with get_serving_url()

I have created website where users can upload image with any size.
I have served images with get_serving_url function.
I have added to end of image modifiers to resize image to 200px size.
http://127.0.0.1:8080/_ah/img/dtrh0i6I_V5JGulg2_LKZw===s200
I have uploaded image 1000x800 - and all right - I have image with size 200x160
If I have uploaded image 100x50 - in result I have resized image with size 200x100. But this is not a good. I need to show original small image, if image size lower that 200px.
How to do this on Google App Engine + Python with get_serving_url?
What you need can't be done automatically using get_serving_url.
I think the easiest way to implement that would be saving the image along with a needs_resize property and calling get_serving_url without size parameter if that is not the case (which serves the original image).

CameraCaptureTask return only pictures with 1296x972 resolution in WP7

I'm using CameraCaptureTask chooser and always is returning a smaller photo that the original. Camera has a resolution of 2592x1944, but the returned photo is always 1296x972. I'm using a LG E-900.
Any ideas ?
Any JPG or PNG image file that is loaded into a BitmapImage object on Windows Phone will automatically be re-sized to be less than 2000x2000 to reduce the internal memory used to display the image to the screen. If you must access the image at a higher resolution you will need access to the original byte stream (e.ChosenPhoto from the completed event for example) and then load that into a System.Windows.Media.Imaging.WriteableBitmap object.
The issue then becomes that you may need to know the original size of the image, as the WriteableBitmap takes a size and width as part of it's constructor and will automatically re-size the image that you try and load into it. I believe the only way to load a high resolution image at it's original size is to use ExifLib on the byte stream to detect the original height and width, then create a WriteableBitmap at that size and use the System.Windows.Media.Imaging - Extensions.LoadJpeg method to load the image into the object. For more image loading samples see this question regarding re-sizing an image on Windows Phone.
Sorry - but there's currently no way to do this - see Is it possible to configure the resolution of `CameraCaptureTask` in WP7?
if you are lucky, then the new Mango SDK might help - it's now 2 weeks away.

Resources