... クトです。 入力がファイルパスの場合は、そのパスからラスタがオープンされます。入力が辞書の生データの場合、パラメータ width 、 height 、 srid が必要です。入力がバイトオブジェクトの場合、GDALの仮想ファイルシステムを使用してオープンされます。 辞書入力を使用し ... DALRaster ( "/path/to/your/raster.tif" , write = False ) >>> rst . name '/path/to/your/raster.tif' >>> rst . width , rst . height # This file has 163 x 174 pixels (163, 174) >>> rst = GDALRaster ( ... { # Creates an in-memory raster ... "srid" : 4326 , ... ... "width" : 4 , ... "height" : 4 , ... "datatype" : 1 , ... "bands" : [ ... { ... "data" : ( 2 , 3 ), ... "offset" : ( 1 , 1 ), ... "size" : ( 2 , 2 ) ... ... ... t.size myfile.save_content_file() myfile.content.save() myfile.get_content_width() myfile.content.width myfile.get_content_height() myfile.content.height Note that the width and height attributes only make sense for ImageField fields. More details can ... ... ルドを小文字にした値の降順と、 pub_date フィールドのデフォルトの昇順で、インデックスを作成します。 もう1つの例: Index ( F ( "height" ) * F ( "weight" ), Round ( "weight" ), name = "calc_idx" ) この例は、 height および weight フィールドの積の結果と、 weig ... ... "rb" ) as f : ... car . specs = File ( f , name = path . name ) ... car . save () ... 注釈 ImageField のインスタンスでは、 height , width , size などの画像データ以外の属性は利用可能ですが、ベースとなる画像データは画像を開き直さなければ利用できません。た ... >> from PIL import Image >>> car = Car . objects . get ( name = "57 Chevy" ) >>> car . photo . width 191 >>> car . photo . height 287 >>> image = Image . open ( car . photo ) # Raises ValueError: seek of closed file. >>> car . photo . open () <ImageFie ... ... 保存に使用できます: >>> from django.contrib.gis.gdal import GDALRaster >>> rast = GDALRaster ( ... { ... "width" : 10 , ... "height" : 10 , ... "name" : "Canyon" , ... "srid" : 4326 , ... "scale" : [ 0.1 , - 0.1 ], ... "bands" : [{ "data" : range ( 100 ) ... this is equivalent to: >>> dem = Elevation . objects . create ( ... name = "Canyon" , ... rast = { ... "width" : 10 , ... "height" : 10 , ... "name" : "Canyon" , ... "srid" : 4326 , ... "scale" : [ 0.1 , - 0.1 ], ... "bands" : [{ "data" : range ( 100 ) ... ... s.ImageFile は File のすべての属性とメソッドを継承し、さらに次のものを提供します: width [ソース] 画像の幅 (ピクセル単位)。 height [ソース] 画像の高さ(ピクセル単位)。 オブジェクトに添付されたファイルに関する追加メソッド オブジェクト(以下の Car.photo の ... ... models . Model ): first_name = models . CharField ( max_length = 255 ) last_name = models . CharField ( max_length = 255 ) height = models . IntegerField () weight = models . IntegerField () class Meta : indexes = [ Index ( Lower ( "first_name" ), Uppe ... r ( "last_name" ) . desc (), name = "first_last_name_idx" , ), Index ( F ( "height" ) / ( F ( "weight" ) + Value ( 5 )), name = "calc_idx" , ), ] Functional indexes are added to models using the Meta.index ... ... e_dimension_fields(force=True) が呼び出されなくなりました。ストレージバックエンドが画像をリサイズする場合、 width_field と height_field が実際の画像の幅と高さと一致しなくなります。 asgiref の最小サポートバージョンが 3.7.0 から 3.8.1 に引き上げられました ... 削除されました。 django.contrib.postgres.fields.CIText ミックスインは削除されました。 BaseGeometryWidget の map_width と map_height 属性は削除されました。 SimpleTestCase.assertFormsetError() メソッドは削除されました。 TransactionTestCase.assertQuerysetEq ... ... 、ブランク値は null として保持されるため、null 値を許容する必要があります。 ImageField class ImageField ( upload_to = None , height_field = None , width_field = None , max_length = 100 , ** options ) [ソース] FileField から全ての属性とメソッドを継承して、 ... にアップロードされたオブジェクトが有効な画像であることを検証します。 FileField で使える専用の属性に加えて、 ImageField には height と width 属性があります。 これらの属性に対するクエリを容易にするために、 ImageField は以下のオプション引数を持ちます: Imag ... eField. height_field 画像オブジェクトがセットされるたびに自動的に画像の高さが入力されるモデルフィールドの名前。 ImageField. width_field 画 ... 2026年10月08日