There is nothing wrong in principle with selling books of knowledge, even if it is not Islamic knowledge such as fiqh, hadeeth and tafseer; rather it is sufficient that these books should not contain things that are contrary to Islam and go against its rulings and etiquette.
With regard to textbooks that are used by students and universities, the need for them is greater. As for what these books contain of pictures that are not compatible with Islamic teachings, as mentioned in the question, if the pictures are few and are not sought in and of themselves, rather the purchaser buys the books because of the beneficial knowledge they contain, such as medical textbooks in which there are illustrations or books that explain by means of pictures, there is nothing wrong with buying and selling these, in sha Allah, because of the general need for them and the difficulty of avoiding the pictures they contain.
But if the seller knows that a specific purchaser is only buying the book because of the pictures in it, then he should not sell it to him.
See the answer to question no. 138655
With regard to books of philosophy, if they are textbooks required as part of the curriculum, there is nothing wrong with selling them to those who need them for their studies, in sha Allah. Similarly, it is permissible to sell them to one who it is thought most likely will benefit from what is in them and is safe from any confusion they may cause, or he will benefit others by teaching and warning against what the books may contain of things that are contrary to Islam.
The seller does not have to probe deeply into the intention of each purchaser; rather it is sufficient for him to act upon what he thinks most likely to be the case and what appears to be the case.
And Allah knows best.
Reproduced from Islam QA