סינון DNG באמצעות Java
בנה יישומי Java משלך כדי לסנן קבצי DNG באמצעות ממשקי API בצד השרת.
כיצד לסנן קבצים ב-DNG באמצעות Java
אפילו את התמונה המושלמת ביותר ניתן לשפר עוד יותר או להפוך ליצירת אמנות שונה וייחודית לחלוטין. החל מסננים כדי להשיג מגוון רחב של אפקטים של תמונה. לדוגמה, אתה יכול לחדד תמונה או להיפך, להוסיף טשטוש, להחליק אותה או לבטל רעשי צבע. מסננים הם גם יקרי ערך כאשר אתה רוצה להקנות ייחודיות לתמונה שלך. כדי להשיג זאת, החל את האפקט הרצוי או שלבו אפקטים שונים. גישה זו מאפשרת לך לחדד את מעברי הצבע, לחסל רעש, ובו זמנית לשפר את החדות של קצוות האובייקטים בתמונה. כדי לסנן קבצים DNG, נשתמש Aspose.Imaging for Java API שהוא עשיר בתכונות, חזק וקל לשימוש למניפולציה והמרה של תמונות עבור פלטפורמת Java. אתה יכול להוריד את הגרסה האחרונה שלו ישירות מ- Maven ולהתקין אותה בתוך ה-Maven שלך פרויקט מבוסס על ידי הוספת התצורות הבאות לקובץ pom.xml.
מאגר
<repository>
<id>AsposeJavaAPI</id>
<name>Aspose Java API</name>
<url>https://repository.aspose.com/repo/</url>
</repository>
תלות
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-imaging</artifactId>
<version>version of aspose-imaging API</version>
<classifier>jdk16</classifier>
</dependency>
שלבים לסינון DNG באמצעות Java
אתה צריך את aspose-imaging-version-jdk16.jar כדי לנסות את זרימת העבודה הבאה בסביבה שלך.
- טען קבצים DNG בשיטת Image.Load
- סינון תמונות;
- שמור תמונה דחוסה לדיסק בפורמט הנתמך על ידי Aspose.Imaging
דרישות מערכת
Aspose.Imaging עבור Java נתמך בכל מערכות ההפעלה העיקריות. רק ודא שיש לך את התנאים המוקדמים הבאים.
- מותקן JDK 1.6 ומעלה.
סנן תמונות DNG - Java
import com.aspose.imaging.IMultipageImage; | |
import com.aspose.imaging.Image; | |
import com.aspose.imaging.RasterImage; | |
import com.aspose.imaging.imageoptions.PngOptions; | |
import java.io.File; | |
import java.util.Arrays; | |
import java.util.LinkedList; | |
import java.util.List; | |
import java.util.function.Consumer; | |
medianfilter(); | |
public static void smallRectangularfilter() | |
{ | |
filterImages(image -> | |
{ | |
// https://apireference.aspose.com/imaging/java/com.aspose.imaging.imagefilters.filteroptions/SmallRectangularFilterOptions | |
Rectangle filterRect = new Rectangle(image.getWidth() / 6, image.getHeight() / 6, image.getWidth() * 2 / 3, image.getHeight() * 2 / 3); | |
image.filter(filterRect, new SmallRectangularFilterOptions()); | |
}, "smallrectangular"); | |
} | |
public static void bigRectangularfilter() | |
{ | |
filterImages(image -> | |
{ | |
// https://apireference.aspose.com/imaging/java/com.aspose.imaging.imagefilters.filteroptions/BigRectangularFilterOptions | |
Rectangle filterRect = new Rectangle(image.getWidth() / 6, image.getHeight() / 6, image.getWidth() * 2 / 3, image.getHeight() * 2 / 3); | |
image.filter(filterRect, new BigRectangularFilterOptions()); | |
}, "bigrectangular"); | |
} | |
public static void sharpenfilter() | |
{ | |
filterImages(image -> | |
{ | |
// https://apireference.aspose.com/imaging/java/com.aspose.imaging.imagefilters.filteroptions/SharpenFilterOptions | |
Rectangle filterRect = new Rectangle(image.getWidth() / 6, image.getHeight() / 6, image.getWidth() * 2 / 3, image.getHeight() * 2 / 3); | |
image.filter(filterRect, new SharpenFilterOptions()); | |
}, "sharpen"); | |
} | |
public static void motionWienerfilter() | |
{ | |
filterImages(image -> | |
{ | |
// https://apireference.aspose.com/imaging/java/com.aspose.imaging.imagefilters.filteroptions/MotionWienerFilterOptions | |
Rectangle filterRect = new Rectangle(image.getWidth() / 6, image.getHeight() / 6, image.getWidth() * 2 / 3, image.getHeight() * 2 / 3); | |
image.filter(filterRect, new MotionWienerFilterOptions(20, 2, 0)); | |
}, "motionwiener"); | |
} | |
public static void bilateralSmoothingfilter() | |
{ | |
filterImages(image -> | |
{ | |
// https://apireference.aspose.com/imaging/java/com.aspose.imaging.imagefilters.filteroptions/BilateralSmoothingFilterOptions | |
Rectangle filterRect = new Rectangle(image.getWidth() / 6, image.getHeight() / 6, image.getWidth() * 2 / 3, image.getHeight() * 2 / 3); | |
image.filter(filterRect, new BilateralSmoothingFilterOptions()); | |
}, "bilateralsmoothing"); | |
} | |
public static void gaussBlurfilter() | |
{ | |
filterImages(image -> | |
{ | |
// https://apireference.aspose.com/imaging/java/com.aspose.imaging.imagefilters.filteroptions/GaussianBlurFilterOptions | |
Rectangle filterRect = new Rectangle(image.getWidth() / 6, image.getHeight() / 6, image.getWidth() * 2 / 3, image.getHeight() * 2 / 3); | |
image.filter(filterRect, new GaussianBlurFilterOptions(5, 4)); | |
}, "gaussblur"); | |
} | |
public static void gaussWienerfilter() | |
{ | |
filterImages(image -> | |
{ | |
// https://apireference.aspose.com/imaging/java/com.aspose.imaging.imagefilters.filteroptions/GaussWienerFilterOptions | |
Rectangle filterRect = new Rectangle(image.getWidth() / 6, image.getHeight() / 6, image.getWidth() * 2 / 3, image.getHeight() * 2 / 3); | |
image.filter(filterRect, new GaussWienerFilterOptions(5, 5)); | |
}, "gausswiener"); | |
} | |
public static void medianfilter() | |
{ | |
filterImages(image -> | |
{ | |
// https://apireference.aspose.com/imaging/java/com.aspose.imaging.imagefilters.filteroptions/MedianFilterOptions | |
Rectangle filterRect = new Rectangle(image.getWidth() / 6, image.getHeight() / 6, image.getWidth() * 2 / 3, image.getHeight() * 2 / 3); | |
image.filter(filterRect, new MedianFilterOptions(20)); | |
}, "median"); | |
} | |
static String templatesFolder = "D:\\"; | |
public static void filterImages(Consumer<RasterImage> doFilter, String filterName) | |
{ | |
List<String> rasterFormats = Arrays.asList("jpg", "png", "bmp", "apng", "dicom", | |
"jp2", "j2k", "tga", "webp", "tif", "gif", "ico"); | |
List<String> vectorFormats = Arrays.asList("svg", "otg", "odg", "eps", "wmf", "emf", "wmz", "emz", "cmx", "cdr"); | |
List<String> allFormats = new LinkedList<>(rasterFormats); | |
allFormats.addAll(vectorFormats); | |
allFormats.forEach( | |
formatExt -> | |
{ | |
String inputFile = templatesFolder + "template." + formatExt; | |
boolean isVectorFormat = vectorFormats.contains(formatExt); | |
//Need to rasterize vector formats before background remove | |
if (isVectorFormat) | |
{ | |
inputFile = rasterizeVectorImage(formatExt, inputFile); | |
} | |
String outputFile = templatesFolder + String.format("%s_%s.png", filterName, formatExt); | |
System.out.println("Processing " + formatExt); | |
try (RasterImage image = (RasterImage) Image.load(inputFile)) | |
{ | |
doFilter.accept(image); | |
//If image is multipage save each page to png to demonstrate results | |
if (image instanceof IMultipageImage && ((IMultipageImage) image).getPageCount() > 1) | |
{ | |
IMultipageImage multiPage = (IMultipageImage) image; | |
final int pageCount = multiPage.getPageCount(); | |
final Image[] pages = multiPage.getPages(); | |
for (int pageIndex = 0; pageIndex < pageCount; pageIndex++) | |
{ | |
String fileName = String.format("%s_page%d_%s.png", filterName, pageIndex, formatExt); | |
pages[pageIndex].save(fileName, new PngOptions()); | |
} | |
} | |
else | |
{ | |
image.save(outputFile, new PngOptions()); | |
} | |
} | |
//Remove rasterized vector image | |
if (isVectorFormat) | |
{ | |
new File(inputFile).delete(); | |
} | |
} | |
); | |
} | |
private static String rasterizeVectorImage(String formatExt, String inputFile) | |
{ | |
String outputFile = templatesFolder + "rasterized."+ formatExt + ".png"; | |
try (Image image = Image.load(inputFile)) | |
{ | |
image.save(outputFile, new PngOptions()); | |
} | |
return outputFile; | |
} |
אודות Aspose.Imaging עבור API של Java
Aspose.Imaging API הוא פתרון לעיבוד תמונה ליצירה, שינוי, ציור או המרת תמונות (תמונות) בתוך יישומים. הוא מציע: עיבוד תמונה חוצה פלטפורמות, כולל אך לא רק המרות בין פורמטים שונים של תמונה (כולל עיבוד תמונה אחיד מרובה עמודים או ריבוי מסגרות), שינויים כגון ציור, עבודה עם פרימיטיבים גרפיים, טרנספורמציות (שינוי גודל, חיתוך, הפוך וסיבוב , בינאריזציה, גווני אפור, התאמה), תכונות מתקדמות של מניפולציה של תמונות (סינון, שיטוט, מיסוך, ביטול הטיה) ואסטרטגיות אופטימיזציה של זיכרון. זוהי ספרייה עצמאית ואינה תלויה בתוכנה כלשהי לפעולות תמונה. אפשר להוסיף בקלות תכונות המרת תמונה בעלות ביצועים גבוהים עם ממשקי API מקוריים בתוך פרויקטים. אלו הם 100% ממשקי API פרטיים מקומיים ותמונות מעובדות בשרתים שלך.סנן DNG באמצעות אפליקציה מקוונת
סנן מסמכים ב-DNG על ידי ביקור ב אתר האינטרנט של הדגמות חיות . להדגמה החיה יש את היתרונות הבאים
DNG מה זה DNG פורמט קובץ
DNG הוא פורמט תמונה של מצלמה דיגיטלית המשמש לאחסון קבצי גלם. הוא פותח על ידי אדובי בספטמבר 2004. הוא פותח בעיקרו עבור צילום דיגיטלי. DNG הוא הרחבה של פורמט תקן TIFF/EP ומשתמש במטא נתונים באופן משמעותי. על מנת לתפעל נתונים גולמיים ממצלמות דיגיטליות בקלות גמישות ושליטה אמנותית, צלמים בוחרים בקבצי מצלמה גולמיים. פורמטים JPEG ו-TIFF מאחסנים תמונות המעובדות על ידי המצלמה, ולכן אין הרבה מקום לשינויים בפורמטים כאלה.
קרא עודפורמטי סינון נתמכים אחרים
באמצעות Java, אפשר לסנן בקלות פורמטים שונים כולל.