Like point, width used in the development, image compression volume, logical resolution, device resolution, point, pixel

Introduction:

- (void)imagePickerController:(TZImagePickerController *)picker
       didFinishPickingPhotos:(NSArray<UIImage *> *)photos
                 sourceAssets:(NSArray *)assets
        isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto
{
  
}

The method of photos stored in the compressed image good (in a width scaling 828, if the width is less than 828 is not scaled)
in order to obtain the assets obtained from the original image,
the image is 1280 micro-channel width as the compression ratio, etc. , specifically to see the article: https://blog.csdn.net/jaycee110905/article/details/50600566

WeChat rules
a, image height or width is less than equal to 1280 when the image size is unchanged, but still after image compression processing, to obtain the same size image of small files
B, wider or taller than 1280, but the image width height ratio is less than or equal to 2, then the image height or width takes a large geometric compressed to 1280
C, wider or taller than 1280, but the image aspect ratio greater than 2, and greater than 1280 and a high width, the height or width to get smaller geometric compression 1280
D , wider or taller than 1280, but the image aspect ratio greater than 2, and wherein a height or width is less than 1280, then compressed to the same size as a small file picture

For example: Apple 3.5 inches 4 refers to the length of a diagonal line of the display screen (with a ruler out length)
It is often said that the 320 * 480 resolution that is refers to a logical point, width and height of all the code we use are also logical resolution of the unit
which uses the @ 2x images have a point to put inside (2 * 2) pixels, a pixel that is device resolution (pixel), all images are pixel-by @ 1x , @ 2x, @ 3x placed in point
here @ 1x, @ 2x 1, 2 is Scale, Scale * point = pixel;

PPI (Pixels Per Inch pixel density): represents the number of pixels / diagonal length of the phone display (inches)
the DPI (Dots Per Inch): dots per inch

Image Compression:
"pressure": refers to the file size be smaller, but the same number of pixels, the same length and width, reduce the mass, it will also reduce the file size.
"Shrink": refers to the image size becomes smaller, resulting in reduced number of pixels, this will also reduce the file size.

= Horizontal resolution of the original image volume vertical resolution pixel depth / 8 (in bytes)
for example 1024 1024 24-bit color = 1024 BMP 1024 * (8 *. 3) / 8/1024/1024 = 3MB

Pressure:

NSData *data = UIImageJPEGRepresentation(image, compression);//取值0.0-1.0
UIImage *resultImage = [UIImage imageWithData:data];

Shrink:

UIGraphicsBeginImageContext(size);
[image drawInRect:CGRectMake(0, 0, size.width, size.height)];
resultImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
Published 40 original articles · won praise 10 · views 30000 +

Guess you like

Origin blog.csdn.net/ai_pple/article/details/87609150