Skip to content

Commit

Permalink
Merge pull request #2 from JanardhanBS-SyncByte/develop
Browse files Browse the repository at this point in the history
MOSIP-29095
  • Loading branch information
ckm007 authored Sep 6, 2023
2 parents 31c2658 + 2f14e34 commit 90ca257
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
2 changes: 1 addition & 1 deletion image-compressor/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>image-compressor</artifactId>
<groupId>io.mosip.image.compressor.sdk</groupId>
<groupId>io.mosip.image.compressor</groupId>
<version>0.0.1-SNAPSHOT</version>
<name>image-compressor</name>
<description>Image Compressorimplementation of biometrics SDK</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,6 @@ public byte[] resizeAndCompress(byte[] jp2000Bytes) throws IOException {

// standard calculation for image size width = 498 and height = 640 is 0.25f
// Scaling the Image using Resize function
int stdWidth = 498;
int stdHeight = 640;

float fxOrginal = 0.25f;
float fyOrginal = 0.25f;
int compression = 50;
Expand All @@ -170,17 +167,10 @@ public byte[] resizeAndCompress(byte[] jp2000Bytes) throws IOException {
compression = this.getEnv().getProperty(SdkConstant.IMAGE_COMPRESSOR_COMPRESSION_RATIO, Integer.class, 50);
}

float fx = fxOrginal;
float fy = fyOrginal;
if (src.width() != stdWidth || src.height() != stdHeight)
{
fx = (fxOrginal * (stdWidth / src.width()));
fy = (fyOrginal * (stdHeight / src.height()));
LOGGER.info("factor ratio Details");
LOGGER.info(String.format("orginal fx=%.2f, orginal fy=%.2f, fx==%.2f, fy==%.2f ", fxOrginal, fyOrginal, fx, fy));
}
LOGGER.info("Factor ratio Details");
LOGGER.info(String.format("orginal fx=%.2f, orginal fy=%.2f, Compression Ratio==%.2f ", fxOrginal, fyOrginal, compression));

Imgproc.resize(src, dst, new Size(0, 0), fx, fy, Imgproc.INTER_AREA);
Imgproc.resize(src, dst, new Size(0, 0), fxOrginal, fyOrginal, Imgproc.INTER_AREA);
LOGGER.info("Resized Image Details");
LOGGER.info(String.format("Width=%d, Height=%d, Total Size=%d ", dst.width(), dst.height(), (dst.width() * dst.height())));

Expand All @@ -190,7 +180,7 @@ public byte[] resizeAndCompress(byte[] jp2000Bytes) throws IOException {
byte[] data = mem.toArray();

LOGGER.info("Compressed Image Details");
LOGGER.info(String.format("length==%d ", data.length));
LOGGER.info(String.format("Image length==%d ", data.length));

return data;
}
Expand Down

0 comments on commit 90ca257

Please sign in to comment.