Um, your current api query does two very distinct things:
- get the first 10 images from the page Wikipedia:Public Domain - the
pages
result, you could specify additional properties to get for that result set
- search the namespace 6 for the word roses
Unfortunately, you can't restrict the search module to search only in some categories, you can only limit it to a single namespace. So you would need to get the categories of all search results and filter them yourself for images in the Category:Public Domain (and all its subcategories). The API query would look like
api.php?action=query&prop=
imageinfo
|
categories
&
generator
=search&gsrsearch=roses&gsrnamespace=6&format=json
Don't forget to continue the query, if you want 10 images that match your category criteria you might need to query (a lot) more than that.