Images are a massive part of the Internet. On the median web page, images account for 51% of the bytes loaded, so any improvement made to their speed or their size has a significant impact on performance. Today, we are excited to announce Cloudflare’s Image Optimization Testing Tool (as of JUL 2023, this tool is no longer available). Simply enter your website’s URL, and we’ll run a series of autom
For a project KinsburgTV I had to do resize images. At first I copied from one of my projects a template tag for resizing (taking roots from this snippet), but for production it is very slow solution. So I wrote another template tag, which built correct URL for Nginx, and this URL handled in ngx_http_image_filter_module and proxy_cache. I have a chart for comparison, which I did through JMeter, bu
画像ファイルを読み込む関数をテストするのに、外部ファイルからデータを読み込むんじゃなくて、テストコードのほうに持たせてみたかったんだ。 ただ、文字列の十六進数の表現でもたせるとやたらデータ量多くなるし、どうしようかなって考えてた。 Pythonだとbase64のエンコード/デコードが簡単だし、いいんじゃないかと思って試してみた。 Pythonのバージョンは2.7.2で試した。PILを使って画像をリサイズしてJPEGのバイナリ列を返す関数をテストしてみる。 resize_image.py # coding: utf-8 from PIL import Image from StringIO import StringIO # テスト用の1*1pxのJPEGデータ JPEG_IMAGE = \ """/9j/4AAQSkZJRgABAQEAZABkAAD/2wBDAP/////////////
Jcropは画像を四角くクロップするjQueryプラグインです。 写真アップロードサービスやプロフィール画像の切り抜きで活躍しそうなライブラリがJcropです。マウスで範囲指定して画像を四角く切り抜けます。 はい、まずは普通の表示です。マウスで範囲指定します。 こんな感じで範囲指定できます。一度指定した後、マウスで微調整もできます。 正方形に限らず形を決められます。 コールバックにも対応していて、マウスを動かしたタイミングなどが座標付きで取り出せます。 サムネイルビューにも対応しています。範囲指定した部分が小さくなって右側に表示されています。 範囲を大きくしたらサムネイルが自動調整されています。 CSSを使って決められた範囲だけクロップ表示することもできます。 サーバサイドに飛ばしたところです。PHP+GDのスクリプトサンプルも用意されています。 Jcropはサーバサイドに座標を飛ばせるの
先週金曜日(12/2)にクックパッドインフラ勉強会に参加しまして、そこで同社の成田さんから「今日からできるApacheモジュール開発と運用」という発表がありました。 リアルタイム画像変換モジュールの「TOFU」を開発するに至った経緯と、Apacheモジュール開発についてのお話でした。 TOFUは、S3に置かれたマスターとなる画像ファイルを取得し、与えられたパラメータでリアルタイム(オンザフライ)にリサイズ・トリミングを行うモジュール(mod_tofu)です。 料理を楽しくする画像配信システム 実際は、モジュールによる画像取得・変換をベースに、キャッシュや配信までも含めた一連の画像配信システムと言えそうです。 この仕組みをNginxを使って実装できないかと考えて、リアルタイム変換の仕組みをNginxだけで実現する方法を実験してみました。 準備するもの HttpImageFilterModul
ImageOptim makes images load faster Removes bloated metadata. Saves disk space & bandwidth by compressing images without losing quality. Faster web pages and apps Reduces image file sizes — so they take up less disk space and download faster — by applying advanced compression that preserves quality. Image files scrubbed clean Removes invisible junk: private EXIF metadata from digital cameras, em
Twitter has an amazing API and a great developer ecosystem, but there is one pain point: avatars are transient. The profile_image_url attribute in the /users/show endpoint is a direct link to an S3 URL that includes the original file name. This is a problem for a number of reasons. If a user uploads a new profile image with a different file name then the previous profile_image_url goes dead. If yo
mod_small_light - Dynamic image transformation module for Apache2 ============================================================================== The mod_small_light provides a dynamic image transformation. Build Environment ----------------- Supported Platforms: GNU/Linux, and other operating systems support GCC. Build ----- Simply run the configure script with --with-apxs option for analyzing you
ベンチマークスクリプト 4288x2848の画像を180x120、600x400、1200x800にリサイズします。 それぞれ10回ずつの合計値をとっています。JPEGの保存品質(quality)は95にしました。 kaa-imlib2は保存品質を変更できなかったので、値は不明です。 ベンチマーク取得用のスクリプトは以下のような感じです。 from benchmarker import Benchmarker import Image #import PythonMagick import pgmagick import opencv.cv as cv import opencv.highgui as highgui import kaa.imlib2 as imlib2 import gd N = 10 def gd_scale(filename, width, height): im
アニメgifか判定のクラス、晒そうと思います。 動かないことに定評があるラブ☆コン(ピュータ)のコードですが、これは動きます。 <?php // mana @20090328 class IfAnimationGif{ var $path; function __construct($path){ $this->path = $path; } function judge(){ $imgcnt = 0; $fp = fopen($this->path,"rb"); @fread($fp,4); $c = @fread($fp,1); if(ord($c) !== 0x39) { // GIF89aである(アニメーションかも) return false; } while(!feof($fp)){ do{ $c = fread($fp,1); }while(ord($c) !== 0x21 &
$FileInfo = getimagesize($ImagePath); if ($FileInfo['channels'] == 1) { echo 'これはグレースケールです。'; } else if ($FileInfo['channels'] == 2) { echo 'これは?です。'; } else if ($FileInfo['channels'] == 3) { echo 'これはRGBです。'; } else if ($FileInfo['channels'] == 4) { echo 'これはCMYKです。'; }
About ResizR ResizR is a nifty, free and very useful little helper. ResizR allows you to resize an image from your local computer or the web. Why? Often you do not need more than just resizing an image on the fly. Before ResizR you required a desktop software to do this - heavy applications which can do much more than just resizing an image. ResizR changes the game - it's much easier. Select an
みんなのIoT/みんなのPythonの著者。二子玉近く160平米の庭付き一戸建てに嫁/息子/娘/わんこと暮らしてます。月間1000万PV/150万UUのWebサービス運営中。 免責事項 プライバシーポリシー 画像のデータしかない状態で,画像のタイプ(JPEGとかGIFとかPNGとか)を判別する方法のメモ。 画像のヘッダを調べるといい。画像のタイプごとに,ヘッダにタイプが埋め込まれているので,判別に利用する。 JPEG : 7バイト目からが'JFIF' GIF : 先頭が'GIF' PNG : 2バイト目からが'PNG' Pythonの関数で書くとこんな感じ。 def detect_imagetype(image): if image[6:10]=='JFIF': return 'image/jpeg' if image[0:3]=='GIF': return 'image/gif' if
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く