3

Please help me. I need help to convert a TIFF file to JPG file, I do this with command line and ImageMagick from Ubuntu, like this

convert 03.tif 03.jpg

But my JPG file after convert like this enter image description here

I checked identify TIF file

$ magick identify -verbose 03.tif
Image:
  Filename: 03.tif
  Format: TIFF (Tagged Image File Format)
  Mime type: image/tiff
  Class: DirectClass
  Geometry: 3507x2480+0+0
  Resolution: 299.999x299.999
  Print size: 11.69x8.26669
  Units: PixelsPerInch
  Colorspace: sRGB
  Type: PaletteAlpha
  Base type: TrueColor
  Endianness: LSB
  Depth: 8/4-bit
  Channel depth:
    Red: 4-bit
    Green: 1-bit
    Blue: 1-bit
    Alpha: 1-bit
  Channel statistics:
    Pixels: 8697360
    Red:
      min: 0  (0)
      max: 255 (1)
      mean: 246.36 (0.966117)
      median: 255 (1)
      standard deviation: 39.0814 (0.153261)
      kurtosis: 19.4019
      skewness: -4.56442
      entropy: 0.125155
    Green:
      min: 0  (0)
      max: 0 (0)
      mean: 0 (0)
      median: 0 (0)
      standard deviation: 0 (0)
      kurtosis: -3
      skewness: 0
      entropy: 0
    Blue:
      min: 0  (0)
      max: 0 (0)
      mean: 0 (0)
      median: 0 (0)
      standard deviation: 0 (0)
      kurtosis: -3
      skewness: 0
      entropy: 0
    Alpha:
      min: 255  (1)
      max: 255 (1)
      mean: 255 (1)
      median: 255 (1)
      standard deviation: -nan (-nan)
      kurtosis: -2.57089e+58
      skewness: 1.58031e+41
      entropy: 0

I want to convert TIF to JPG file this like original TIF file.

2
  • 2
    There was a bug in ImageMagick quite recently affecting red channel of TIFFs. Maybe try an upgrade. See stackoverflow.com/q/67006215/2836621 Commented Apr 20, 2021 at 7:44
  • Thank you very much. I try tn upgrade verion Imagemagick from 7.0.10-48 to 7.0.10-57 and the problem is resolved.
    – Rua Tahi
    Commented Apr 21, 2021 at 5:53

1 Answer 1

1

I user docker and build image FROM php:7.3-fpm-alpine. I try to add imagemagick lib, but lastest version for 7.3-fpm-alpine is 7.0.10-48. like this

FROM php:7.3-fpm-alpine
RUN apk add --no-cache --virtual .build-deps \
    $PHPIZE_DEPS \
    curl-dev \
    imagemagick-dev \
    libtool \
    libxml2-dev \
    postgresql-dev \
    sqlite-dev \
&& apk add --no-cache \
    curl \
    git \
    imagemagick \
    mysql-client \
    postgresql-libs \
    libintl \
    icu \
    icu-dev \
    libzip-dev \
    freetype \
    libpng \
    libjpeg-turbo \
    freetype-dev \
    libpng-dev \
    libjpeg-turbo-dev \
    supervisor \
&& pecl install imagick \
&& docker-php-ext-enable imagick \

To resolve that problem, I change php:7.3-fpm-alpine to php:7.3.27-fpm-alpine3.13 And rebuild my container. It work for me. Thanks Mark Setchell for supporting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.