HivePaaS
Docker Swarm 기반 오픈소스 자체 호스팅 PaaS, SSL·백업·자동 확장 지원
Dart Image Library for opening, manipulating, and saving various different image file formats.
개발 도구Dart · CSSGitHub @brendan-duncan직접 설치운영자 미확인
써 보셨어요? 한 번만 눌러 주세요. 로그인은 필요 없어요.
아직 감지된 업데이트가 없습니다. GitHub 릴리스가 나오면 여기에 보입니다.
개인 계정의 공개 저장소 소유자는 GitHub로 로그인해 운영자를 확인하고 소개를 직접 관리할 수 있습니다. 관리자 승인은 필요하지 않습니다.
로그인한 뒤 확인 파일을 만들어 이 저장소의 기본 브랜치에 30분 안에 커밋해 주세요. 다른 브랜치나 포크의 파일은 인정하지 않습니다. 파일을 올린 뒤 아래에서 확인하면 관리자 승인 없이 관리할 수 있습니다. 자격을 유지하려면 파일을 남겨 두세요.
로그인이 필요하면 로그인 화면으로 이동합니다. 로그인 후 이곳으로 돌아와 원하는 확인 버튼을 다시 눌러 주세요.
설치형 프로젝트는 배포 도메인 없이도 확인할 수 있습니다. 개인 저장소는 GitHub 로그인으로, 조직 저장소는 위의 저장소 확인 파일로 직접 확인해 주세요.
메이커가 쓴 소개는 위의 한 줄이 전부입니다. 더 자세한 내용은 저장소 README에서 읽을 수 있습니다. 저장소 README ↗
README 전체를 불러오는 중입니다.
README 전문 보기 ↗The Dart Image Library loads, saves and manipulates images in a variety of image file formats.
It's written in pure Dart with no native dependencies, so it works everywhere Dart does: command-line apps, servers, Flutter on every platform, and the web.
Features include:
Read/Write
Read Only
Write Only
dart pub add image
import 'package:image/image.dart' as img;
Create an image, set pixel values, and save it as a PNG:
import 'dart:io';
import 'package:image/image.dart' as img;
Future<void> main() async {
// Create a 256x256 8-bit (default) RGB (default) image.
final image = img.Image(width: 256, height: 256);
// Iterate over its pixels.
for (final pixel in image) {
pixel
// Set the red channel to the x position, creating a gradient.
..r = pixel.x
// Set the green channel to the y position.
..g = pixel.y;
}
// Encode the image to the PNG format.
final png = img.encodePng(image);
// Write the PNG data to a file.
await File('image.png').writeAsBytes(png);
}
Load a JPEG, make a thumbnail, and save it:
import 'dart:io';
import 'package:image/image.dart' as img;
Future<void> main() async {
final bytes = await File('photo.jpg').readAsBytes();
// Decode the JPEG. This returns null, or throws an ImageException, if the
// data isn't a valid JPEG.
final image = img.decodeJpg(bytes);
if (image == null) {
return;
}
// Resize to 120 pixels wide, keeping the aspect ratio. The EXIF orientation
// of the photo is applied.
final thumbnail = img.copyResize(image, width: 120);
// Encode as a JPEG and save it.
await File('thumbnail.jpg').writeAsBytes(img.encodeJpg(thumbnail, quality: 85));
}
Do the same work in a separate isolate with the Command API, so it doesn't block the main isolate:
import 'package:image/image.dart' as img;
Future<void> main(List<String> args) async {
final path = args.isNotEmpty ? args[0] : 'test.png';
final cmd = img.Command()
// Decode the image file at the given path.
..decodeImageFile(path)
// Resize the image to a width of 64 pixels, keeping the aspect ratio.
..copyResize(width: 64)
// Write the image to a PNG file (the format comes from the file extension).
..writeToFile('thumbnail.png');
// On platforms that support isolates, execute the commands on a separate
// isolate. Otherwise (on the web), they run on the main thread.
await cmd.executeThread();
}
See the tutorial for more.