Skip to content

Instantly share code, notes, and snippets.

View aspose-com-gists's full-sized avatar

Aspose.com Gists aspose-com-gists

View GitHub Profile
@aspose-com-gists
aspose-com-gists / Reduce-SVG-File-Size.cs
Created May 24, 2024 12:29
Reduce SVG File Size in C#
namespace CSharp.ResizeSVG
{
class ResizeSVG
{
static void Main(string[] args)
{
// Define the path to the documents directory.
string dataDir = "/Desktop/";
// Load the source SVG image by calling the Load method of the Image class.
using (SvgImage image = (SvgImage)Image.Load(dataDir + "aspose_logo.Svg"))
using Aspose.Imaging.HEIC.Adapter;
using Aspose.Imaging.ImageOptions;
//You can get all image templates from https://github.com/aspose-imaging/Aspose.Imaging-for-.NET/blob/master/Examples/Data/Templates.zip
//After download archive please unpack it and replace templatesFolder variable path with your path to unpacked archive folder
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
// register adapter
HEICImage.Register();
using Aspose.Imaging.HEIC.Adapter;
using Aspose.Imaging.ImageOptions;
//You can get all image templates from https://github.com/aspose-imaging/Aspose.Imaging-for-.NET/blob/master/Examples/Data/Templates.zip
//After download archive please unpack it and replace templatesFolder variable path with your path to unpacked archive folder
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
// register adapter
HEICImage.Register();
public class Main {
public static void main(String[] args) throws java.io.IOException {
String dir = "/Desktop/";
String outpath = dir+"eclipse.bmp";
BmpOptions saveOptions = new BmpOptions();
saveOptions.setBitsPerPixel(32);
// Create an instance of Image
try (Image image = new PsdImage(100, 100)) {
// Create and initialize an instance of Graphics class and Clear Graphics surface
@aspose-com-gists
aspose-com-gists / Draw-a-Line.java
Last active May 23, 2024 12:48
Draw a Line in Java
public class Main {
public static void main(String[] args) throws java.io.IOException {
String dir = "/Desktop/";
String outpath = dir+"line.bmp";
// Create an instance of the BmpOptions class.
BmpOptions saveOptions = new BmpOptions();
// Invoke the setBitsPerPixel method to set the Bits per Pixel.
saveOptions.setBitsPerPixel(32);
// Initialize an object of Image class with an instance of the PsdImage class.
try (Image image = new PsdImage(100, 100)) {
@aspose-com-gists
aspose-com-gists / Convert-ZIP-to-TAR-GZ.java
Created May 18, 2024 16:39
Convert ZIP to TAR.GZ in Java Programmatically
package com.example;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import com.aspose.zip.Archive;
import com.aspose.zip.ArchiveEntry;
import com.aspose.zip.TarArchive;
import com.aspose.zip.exceptions.IOException;
public class Main {
// Convert ZIP to TAR.GZ in Java
@aspose-com-gists
aspose-com-gists / convert-rar-to-zip.java
Created May 17, 2024 16:16
Convert RAR to ZIP in Java
package com.example;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import com.aspose.zip.Archive;
import com.aspose.zip.RarArchive;
import com.aspose.zip.RarArchiveEntry;
import com.aspose.zip.exceptions.IOException;
public class Main {
// Convert RAR to ZIP in Java