diff --git a/lib/jekyll_picture_tag/output_formats/img.rb b/lib/jekyll_picture_tag/output_formats/img.rb
index <HASH>..<HASH> 100644
--- a/lib/jekyll_picture_tag/output_formats/img.rb
+++ b/lib/jekyll_picture_tag/output_formats/img.rb
@@ -16,20 +16,19 @@ module PictureTag
 
         add_srcset(img, srcset)
         add_sizes(img, srcset)
-        add_dimensions(img, srcset)
 
         img.attributes << PictureTag.html_attributes['parent']
 
+        add_dimensions(img, srcset)
+
         img
       end
 
       def add_dimensions(img, srcset)
         return unless PictureTag.preset['dimension_attributes']
 
-        img.attributes << {
-          width: srcset.width_attribute,
-          height: srcset.height_attribute
-        }
+        img.width = srcset.width_attribute
+        img.height = srcset.height_attribute
       end
     end
   end
Ensure width and height are replaced instead of appended