Limit function to specific post category

You should check for category posts to modify content. Specify category ID (integer), name or slug (string), or an array of these in in_category check.

function my_image_tag( $html, $id , $alt, $title ) {
    if ( in_category( '1' ) ) {
        $html = "<div class="my-class">" . $html . "</div>";
    }
    return $html;
}

add_filter( 'get_image_tag', 'my_image_tag', 10 ,4 );

For category slug blog-post you can use in_category( 'blog-post' )

If you want to use more then 1 category then you can do something like.

in_category( array( '15', 'Tropical Birds', 'small-mammals' ) )

It’s a combination of ID, Name and slug. SO it’s up to you how you can to use it.

EDIT

If you are using this outside loop then try this.

function my_image_tag( $html, $id , $alt, $title ) {
    global $post;
    if ( in_category( '1' ) ) {
        $html = "<div class="my-class">" . $html . "</div>";
    }
    return $html;
}
add_filter( 'get_image_tag', 'my_image_tag', 10 ,4 );