Skip to content

examples with imagemagick conver return an error for any images #3557

@vladyslav2

Description

@vladyslav2

Thanks for stopping by to let us know something could be better!

In which file did you encounter the issue?

Trying to run this example https://github.com/GoogleCloudPlatform/golang-samples/blob/HEAD/functions/imagemagick/imagemagick.go and got stuck with an error convert-im6.q16: no decode delegate for this image format . At first I thought its a problem with an image and old convert on the google cloud. But more tests confirmed that all images getting the same error. Finally installing same convert version locally confirmed that problems aren't images itself.

Tried png, jpeg, jpg, heic, webp formats - all of them got same error message

Did you change the file? If so, how?

At first yes, but problem later confirmed problem with an original file

Describe the issue

  1. Deploy https://github.com/GoogleCloudPlatform/golang-samples/blob/HEAD/functions/imagemagick/imagemagick.go using this script:
gcloud functions deploy BlurOffensiveImages \
  --runtime go120 \
  --region=europe-central2 \
  --project=YOUR_PROJECT \
  --source=. \
  --entry-point=BlurOffensiveImages \
  --run-service-account=storage-file-transformer-ca@your_project.iam.gserviceaccount.com \
  --trigger-service-account=storage-file-transformer-ca@your_project.iam.gserviceaccount.com \
  --trigger-resource your-media-storage-bucket \
  --env-vars-file .env-file-with-thumb-storage.env \
  --trigger-event google.storage.object.finalize
  1. upload nude image on storage bucket
  2. check cloud func logs, you'll see an error log message
Function error: cmd.Run: exit status 1 convert-im6.q16: no decode delegate for this image format `' @ error/constitute.c/ReadImage/587.
convert-im6.q16: no images defined `-' @ error/convert.c/ConvertImageCommand/3229

Additional information

Obviously, image repo example zombie eating zombie give same error too

also, for some reason identity -list format returns an empty list for me, i.e.

formats := bytes.Buffer{}
formatsWriter := io.Writer(&formats)
cmd := exec.Command("identify", "-list", "format")
cmd.Stdout = formatsWriter
fmt.Printf("formats: %s\n", formats.String())

will echo nothing during cloud func execution.

Doing the same on my local machine will return huge list:

   Format  Module    Mode  Description
-------------------------------------------------------------------------------
      3FR  DNG       r--   Hasselblad CFV/H3D39II (0.21.1-Release)
      3G2  VIDEO     r--   Media Container
      3GP  VIDEO     r--   Media Container
      AAI* AAI       rw+   AAI Dune image
       AI  PDF       rw-   Adobe Illustrator CS2
     APNG  VIDEO     rw+   Animated Portable Network Graphics
      ART* ART       rw-   PFS: 1st Publisher Clip Art
      ARW  DNG       r--   Sony Alpha Raw Image Format (0.21.1-Release)
   ASHLAR* ASHLAR    -w+   Image sequence laid out in continuous irregular courses
      AVI  VIDEO     r--   Microsoft Audio/Visual Interleaved
     AVIF  HEIC      rw+   AV1 Image File Format (1.17.0)
      AVS* AVS       rw+   AVS X image
    BAYER* BAYER     rw+   Raw mosaiced samples
   BAYERA* BAYER     rw+   Raw mosaiced and alpha samples
      BGR* BGR       rw+   Raw blue, green, and red samples
     BGRA* BGR       rw+   Raw blue, green, red, and alpha samples
     BGRO* BGR       rw+   Raw blue, green, red, and opacity samples
      BMP* BMP       rw-   Microsoft Windows bitmap image
     BMP2* BMP       rw-   Microsoft Windows bitmap image (V2)
     BMP3* BMP       rw-   Microsoft Windows bitmap image (V3)
      BRF* BRAILLE   -w-   BRF ASCII Braille format
      CAL* CALS      rw-   Continuous Acquisition and Life-cycle Support Type 1
             Specified in MIL-R-28002 and MIL-PRF-28002
     CALS* CALS      rw-   Continuous Acquisition and Life-cycle Support Type 1
             Specified in MIL-R-28002 and MIL-PRF-28002
   CANVAS* XC        r--   Constant image uniform color
  CAPTION* CAPTION   r--   Caption
      CIN* CIN       rw-   Cineon Image File
      CIP* CIP       -w-   Cisco IP phone image format
     CLIP* CLIP      rw+   Image Clip Mask
     CMYK* CMYK    
     ....
     ```

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: p2Moderately-important priority. Fix may not be included in next release.samplesIssues that are directly related to samples.stale: oldPull request is old and needs attention.triage meI really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions