我试过使用jpegoptim,甚至尝试过这个命令,但都很困惑。这里有一个文件我想减少到50k,甚至可以降低数据的质量-
Image:
Filename: shirish.jpg
Format: JPEG (Joint Photographic Experts Group JFIF format)
Mime type: image/jpeg
Class: DirectClass
Geometry: 4624x3468+0+0
Resolution: 72x72
Print size: 64.2222x48.1667
Units: PixelsPerInch
Colorspace: sRGB
Type: TrueColor
Base type: Undefined
Endianness: Undefined
Depth: 8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 8-bit
Channel statistics:
Pixels: 16036032
Red:
min: 0 (0)
max: 255 (1)
mean: 119.779 (0.46972)
standard deviation: 60.359 (0.236702)
kurtosis: -1.33094
skewness: -0.2895
entropy: 0.920909
Green:
min: 0 (0)
max: 255 (1)
mean: 115.071 (0.45126)
standard deviation: 63.5402 (0.249177)
kurtosis: -1.51367
skewness: -0.162973
entropy: 0.912909
Blue:
min: 0 (0)
max: 255 (1)
mean: 114.566 (0.449277)
standard deviation: 61.8685 (0.242621)
kurtosis: -1.51015
skewness: -0.101152
entropy: 0.912805
Image statistics:
Overall:
min: 0 (0)
max: 255 (1)
mean: 116.472 (0.456752)
standard deviation: 61.9226 (0.242834)
kurtosis: -1.46062
skewness: -0.184944
entropy: 0.915541
Rendering intent: Perceptual
Gamma: 0.454545
Chromaticity:
red primary: (0.64,0.33)
green primary: (0.3,0.6)
blue primary: (0.15,0.06)
white point: (0.3127,0.329)
Background color: white
Border color: srgb(223,223,223)
Matte color: grey74
Transparent color: black
Interlace: None
Intensity: Undefined
Compose: Over
Page geometry: 4624x3468+0+0
Dispose: Undefined
Iterations: 0
Compression: JPEG
Quality: 92
Orientation: RightTop
Profiles:
Profile-app4: 7600 bytes
Profile-exif: 51509 bytes
Properties:
date:create: 2022-08-20T05:27:53+00:00
date:modify: 2022-08-20T05:27:53+00:00
exif:ApertureValue: 169/100
exif:BrightnessValue: 264/100
exif:ColorSpace: 1
exif:DateTime: 2022:08:20 10:53:10
exif:DateTimeDigitized: 2022:08:20 10:53:10
exif:DateTimeOriginal: 2022:08:20 10:53:10
exif:DigitalZoomRatio: 100/100
exif:ExifOffset: 226
exif:ExifVersion: 48, 50, 50, 48
exif:ExposureMode: 0
exif:ExposureProgram: 2
exif:ExposureTime: 1/50
exif:Flash: 0
exif:FNumber: 180/100
exif:FocalLength: 532/100
exif:FocalLengthIn35mmFilm: 28
exif:ImageLength: 3468
exif:ImageUniqueID: I64ELODR0PM
exif:ImageWidth: 4624
exif:Make: samsung
exif:MaxApertureValue: 169/100
exif:MeteringMode: 2
exif:Model: SM-M526B
exif:OffsetTime: +05:30
exif:OffsetTimeOriginal: +05:30
exif:PhotographicSensitivity: 160
exif:PixelXDimension: 4624
exif:PixelYDimension: 3468
exif:SceneCaptureType: 0
exif:ShutterSpeedValue: 1/50
exif:Software: M526BXXU1BVG4
exif:thumbnail:Compression: 6
exif:thumbnail:ImageLength: 384
exif:thumbnail:ImageWidth: 512
exif:thumbnail:JPEGInterchangeFormat: 782
exif:thumbnail:JPEGInterchangeFormatLength: 50721
exif:thumbnail:ResolutionUnit: 2
exif:thumbnail:XResolution: 72/1
exif:thumbnail:YResolution: 72/1
exif:WhiteBalance: 0
exif:YCbCrPositioning: 1
jpeg:colorspace: 2
jpeg:sampling-factor: 2x2,1x1,1x1
signature: 7841c1e0cbe1aa5b79f0dea6791ffd321e2cf05715a9ab3cd210fd551c9bf355
Artifacts:
filename: shirish.jpg
verbose: true
Tainted: False
Filesize: 3.65599MiB
Number pixels: 16.036M
Pixels per second: 126.41MB
User time: 0.120u
Elapsed time: 0:01.126
Version: ImageMagick 6.9.11-60 Q16 x86_64 2021-01-25 https://imagemagick.org现在,我尝试了imagemagick和jpegoptim来获得一个大约50k的文件。我需要这个大小的文件,因为我必须上传到某个地方,并有大小的禁忌。
我得到了上述exif和照片数据使用标识-verbose开关在imagemagick。
有人能帮我做上面的事吗。
我试过以下几点-
$jpegoptim --size=50k shirish.jpg我得到的文件不是50 kb,而是200 kb,好但不是我想要的:
我甚至试过-
$jpegoptim --max=10 --size=50k shirish-aadhar-2-reduced.jpg但即便如此,也没有产生预期的结果。
$ jpegoptim --version
jpegoptim v1.4.7 x86_64-pc-linux-gnu (Jun 20 2022)
Copyright (C) 1996-2022, Timo Kokkonen
This program comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistirbute it under certain conditions.
See the GNU General Public License for more details.
libjpeg version: 6b 27-Mar-1998
Copyright (C) 1991-2021 The libjpeg-turbo Project and many others期待着帮助。我知道我可以用一些在线工具来做同样的事情,但是我想离线也是可能的。
发布于 2022-08-20 06:31:59
您可以使用ImageMagick删除所有元数据并降低质量。有关更多信息,请访问这个答案:
在85个渐进式(压缩)中,一个非常微小的高斯模糊来优化尺寸(半径的0.05或0.5 )取决于图像的质量和大小,这明显地优化了jpeg的大小。删除图像中的任何注释或EXIF元数据应转换为-strip -interlace平面-模糊-quality 0.0 5 -quality 85% source.jpg result.jpg或更新版本: magick source.jpg -strip -interlace平面--quality 0.0 5-quality 85% result.jpg
你可以玩-quality号码。但是将16 so图像压缩到50k将不会产生那么好的效果。
发布于 2022-08-20 16:28:03
如果格式为jpg,则可以定义最大文件大小:
convert shirish.jpg -define jpeg:extent=20k shirish-20k.jpg这几乎肯定会大大降低你的形象质量。
但这是值得知道的。
https://unix.stackexchange.com/questions/714248
复制相似问题