0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.135.202.168


Current Path : /var/www/html/suk_discontinued/libgd-gd-2.2.3/tests/png/
Upload File :
Current File : /var/www/html/suk_discontinued/libgd-gd-2.2.3/tests/png/png_resolution.c

#include "gd.h"
#include <stdio.h>
#include <stdlib.h>
#include "gdtest.h"

int main()
{
	gdImagePtr im;
	void *data;
	int size, red;

	im = gdImageCreate(100, 100);
	gdImageSetResolution(im, 72, 300);
	red = gdImageColorAllocate(im, 0xFF, 0x00, 0x00);
	gdImageFilledRectangle(im, 0, 0, 99, 99, red);
	data = gdImagePngPtr(im, &size);
	gdImageDestroy(im);

	im = gdImageCreateFromPngPtr(size, data);
	gdFree(data);

	if (!gdTestAssert(gdImageResolutionX(im) == 72) || !gdTestAssert(gdImageResolutionY(im) == 300)) {
		gdTestErrorMsg("failed image resolution X (%d != 72) or Y (%d != 300)\n", gdImageResolutionX(im), gdImageResolutionY(im));
		gdImageDestroy(im);
		return 1;
	}
		
	gdImageDestroy(im);
	return 0;
}