Skip to main content

Decreasing max image transformation size.

Comments

5 comments

  • Aleksandar Kostadinov

    Hi, thanks for contacting us.

    Currently, 25MP is the minimum and default amount starting at our Free plans. Paid plans allow this (among other) limit(s) to be increased as that's usually the requirement, but for those paid plans, we may also be able to take a look at decreasing this limit if there's a specific requirement or use case by a client.

    Let me know if this clears things up or if you have further questions.

     

    Best regards,

    Aleksandar

    0
  • Bradley McColey

    I recently ran into this error when uploading pdfs to cloudinary when in the past it had worked fine. I am trying to transform the pdf to fewer megapixels, but it's always going over. What's the best way to change the output transformation MP size to come in under 25?

    0
  • Stephen Doyle

    Hi Bradley,

    Do you have an example URL you can share? My first thought is that the PDF may have a very large 'page size' in the metadata, so when it's converted to an image, it's a very large image - if so, you may be able to use the density parameter (dn) to change the DPI at which we rasterize it: https://cloudinary.com/documentation/image_transformation_reference#density_parameter

    If that's not suitable, I recommend that you resize the image to a smaller size as the first step in the transformation, before performing the other steps.
    Regards,

    Stephen

    0
  • Bradley McColey

    Hey Stephen,

    Thanks for the response. I actually tried switching the order and it seems to be working without reaching the MP limit now. Can you explain the technical side of what is happening so I can make sure I know how to avoid the error?

    Here is my transformation:

    array(
      "fetch_format" => "auto",
      "crop" => "limit",
      "width" => 1300,
    ),
    array(
      "overlay" => "logo_blw30s",
      "effect" => "blackwhite", 
      "angle" => 16,
      "height"=> 0.8,
      "flags"=> "relative",
      "opacity" => 8,
    ),

    So at first, I was adding the overlay onto the original file (around a 200KB pdf file), then setting the width to make it smaller. When I changed the order to the way it is listed above, the process executes successfully and the file is uploaded with the given transformation parameters. 

    My guess is that by adding the overlay in the first transformation (the first way I tried), the file grows beyond the 25MP limit and throws the error before it is resized in the second transformation. So could the original file be over the 25MP limit, but as long as your first transformation reduces the size to below 25 it will continue transforming the file? I just want to understand the process to avoid any future problems.

     

    Thanks again!

    Brad

    0
  • Stephen Doyle

    Hi Brad,

    With that change, you're now using one of the solutions I mentioned.

    The specified order of the transformations makes the first step in the transformation a resize, so we'll convert the PDF to an image at that size, then add the overlay.

    With the parameters in the opposite order, we convert the PDF to a raster image using the default density of 150 DPI, which depending on the page size in the PDF's may result in a very large image in some cases, add the overlay, then limit to 1300 pixels wide.

    It's important to know the effect this will have, because (for example) depending on the size of the logo you're adding as an overlay, it may appear significantly larger or smaller than it did before, because the PDF is made smaller before the logo is added.

    Regards,

    Stephen

    0

Post is closed for comments.