Skip to content

Instantly share code, notes, and snippets.

View karnadii's full-sized avatar

Ujang Karnadi karnadii

View GitHub Profile
@karnadii
karnadii / crop_border_image.dart
Last active February 24, 2024 03:24
Crop a white border of an image
// ignore_for_file: avoid_print
// Import necessary libraries
import 'dart:io';
import 'package:image/image.dart' as img;
// Main function
void main(List<String> args) async {
// Check if the path to the image file and the color of the border to remove are provided
if (args.length < 2) {
@karnadii
karnadii / fetch_image_size.dart
Last active March 30, 2024 23:48
prefetch image size
import 'dart:async';
import 'dart:typed_data';
import 'package:http/http.dart' as http;
enum ImageFormat { jpg, gif, png, webp }
class Size {
final int width;
final int height;