title: How to validate of dimensions in default ImageField?
body: <p>Have a following rule in the project: the image field is optional and a default image is an uninformed case for the user. Images are sent by the user in django and must have a dimension (width> = 900, height> = 400).</p>
  
  <p>I am trying to validate the dimensions in admin.py, but it is giving problem when I try to register when it has default argument in imagefield.</p>
  
  <p><a href="https://i.stack.imgur.com/emqrg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/emqrg.png" alt="enter image description here"></a></p>
  
  <p>Gives an image error not found even though it is in the directory. Without the validation function in admin.py it works normally.</p>
  
  <p><strong>models.py</strong></p>
  
  <pre><code>class Event(models.Model):
      banner = models.ImageField('banner', upload_to='events/banners', default='events/banners/banner_padrao_eventos.png', blank=True)
  </code></pre>
  
  <p><strong>admin.py</strong></p>
  
  <pre><code>class EventForm(forms.ModelForm):
      class Meta:
          model = Event
          fields = '__all__'
  
      def clean_banner(self):
          banner = self.cleaned_data.get('banner')
          if banner:
              img = Image.open(banner)
              width, height = img.size
  
              max_width = 900
              max_height = 400
  
              if width &lt; max_width or height &lt; max_height:
                  raise forms.ValidationError(
                      'Image is incorrectly sized:% s x% s pixels. Please insert an image with% s x% s pixels.'
                      % (width, height, max_width, max_height))
  
              if len(banner) &gt; (3 * 1024 * 1024):
                  raise forms.ValidationError('Very large image file (maximum of 3MB).')
  
              name_img, ext = banner.name.split('.')
              if not (ext.lower() in ['png', 'jpg', 'jpeg']):
                  raise forms.ValidationError('Please use the image in JPG, JPEG or PNG format.')
          else:
              raise forms.ValidationError('The loaded image could not be read.')
          return banner
  </code></pre>
  
  <p>How can I make the default image to be considered in the validation?</p>